<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>PowerVR SDK</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<table width="100%">
  <tr>
    <td width="33%">
      <p align="left">&nbsp;<a href="http://www.imgtec.com"><img border="0" src="IMGLogo.jpg" width="200" height="30"></a></p>
    </td>
    <td width="33%">
      <p align="center"><font color="#808080" face="Arial" size="2">PowerVR Software Development Kit</a></font></p>
    </td>
    <td width="34%">
      <p align="right"><a href="http://www.powervr.com"><img border="0" src="PVRlogo.jpg" width="200" height="27"></a></p>
    </td>
  </tr>
</table>
<hr>
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>PVRTVector.h</h1><a href="PVRTVector_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/******************************************************************************</span>
00002 <span class="comment"></span>
00003 <span class="comment"> @File         PVRTVector.h</span>
00004 <span class="comment"></span>
00005 <span class="comment"> @Title        PVRTVector</span>
00006 <span class="comment"></span>
00007 <span class="comment"> @Version      </span>
00008 <span class="comment"></span>
00009 <span class="comment"> @Copyright    Copyright (C)  Imagination Technologies Limited.</span>
00010 <span class="comment"></span>
00011 <span class="comment"> @Platform     ANSI compatible</span>
00012 <span class="comment"></span>
00013 <span class="comment"> @Description  Vector and matrix mathematics library</span>
00014 <span class="comment"></span>
00015 <span class="comment">******************************************************************************/</span>
00016 <span class="preprocessor">#ifndef __PVRTVECTOR_H__</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#define __PVRTVECTOR_H__</span>
00018 <span class="preprocessor"></span>
00019 <span class="preprocessor">#include "assert.h"</span>
00020 <span class="preprocessor">#include "<a class="code" href="PVRTGlobal_8h.html">PVRTGlobal.h</a>"</span>
00021 <span class="preprocessor">#include "<a class="code" href="PVRTFixedPoint_8h.html">PVRTFixedPoint.h</a>"</span>
00022 <span class="preprocessor">#include "<a class="code" href="PVRTMatrix_8h.html">PVRTMatrix.h</a>"</span>
00023 <span class="preprocessor">#include &lt;string.h&gt;</span>
00024 <span class="preprocessor">#include &lt;math.h&gt;</span>
00025 
00026 <span class="comment">/*!***************************************************************************</span>
00027 <span class="comment">** Forward Declarations for vector and matrix structs</span>
00028 <span class="comment">****************************************************************************/</span>
00029 <span class="keyword">struct </span><a class="code" href="structPVRTVec4.html">PVRTVec4</a>;
00030 <span class="keyword">struct </span><a class="code" href="structPVRTVec3.html">PVRTVec3</a>;
00031 <span class="keyword">struct </span><a class="code" href="structPVRTMat3.html">PVRTMat3</a>;
00032 <span class="keyword">struct </span><a class="code" href="structPVRTMat4.html">PVRTMat4</a>;
00033 
00034 <span class="comment">/*!***************************************************************************</span>
00035 <span class="comment"> @Function          PVRTLinearEqSolve</span>
00036 <span class="comment"> @Input             pSrc    2D array of floats. 4 Eq linear problem is 5x4</span>
00037 <span class="comment">                            matrix, constants in first column</span>
00038 <span class="comment"> @Input             nCnt    Number of equations to solve</span>
00039 <span class="comment"> @Output            pRes    Result</span>
00040 <span class="comment"> @Description       Solves 'nCnt' simultaneous equations of 'nCnt' variables.</span>
00041 <span class="comment">                    pRes should be an array large enough to contain the</span>
00042 <span class="comment">                    results: the values of the 'nCnt' variables.</span>
00043 <span class="comment">                    This fn recursively uses Gaussian Elimination.</span>
00044 <span class="comment">*****************************************************************************/</span>
00045 <span class="keywordtype">void</span> <a class="code" href="PVRTVector_8h.html#a0">PVRTLinearEqSolve</a>(VERTTYPE * <span class="keyword">const</span> pRes, VERTTYPE ** <span class="keyword">const</span> pSrc, <span class="keyword">const</span> <span class="keywordtype">int</span> nCnt);
00046 
00047 <span class="comment">/*!***************************************************************************</span>
00048 <span class="comment">    ** PVRTVec2 2 component vector</span>
00049 <span class="comment">    ****************************************************************************/</span>
00050 <span class="keyword">struct </span><a class="code" href="structPVRTVec2.html">PVRTVec2</a>
<a name="l00051"></a><a class="code" href="structPVRTVec2.html">00051</a> {
00052     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> x, y;
<a name="l00053"></a><a class="code" href="structPVRTVec2.html#o1">00053</a>     <span class="comment">/*!***************************************************************************</span>
00054 <span class="comment">        ** Constructors</span>
00055 <span class="comment">        ****************************************************************************/</span>
00056     <span class="comment">/*!***************************************************************************</span>
00057 <span class="comment">        @Function           PVRTVec2</span>
00058 <span class="comment">        @Description        Blank constructor.</span>
00059 <span class="comment">        *****************************************************************************/</span>
00060     <a class="code" href="structPVRTVec2.html#a0">PVRTVec2</a>() {}
00061     <span class="comment">/*!***************************************************************************</span>
<a name="l00062"></a><a class="code" href="structPVRTVec2.html#a0">00062</a> <span class="comment">        @Function           PVRTVec2</span>
00063 <span class="comment">        @Input              fX  X component of vector</span>
00064 <span class="comment">        @Input              fY  Y component of vector</span>
00065 <span class="comment">        @Description        Simple constructor from 2 values.</span>
00066 <span class="comment">        *****************************************************************************/</span>
00067     <a class="code" href="structPVRTVec2.html#a0">PVRTVec2</a>(VERTTYPE fX, VERTTYPE fY) : x(fX), y(fY) {}
00068     <span class="comment">/*!***************************************************************************</span>
00069 <span class="comment">        @Function           PVRTVec2</span>
<a name="l00070"></a><a class="code" href="structPVRTVec2.html#a1">00070</a> <span class="comment">        @Input              fValue  a component value</span>
00071 <span class="comment">        @Description        Constructor from a single value.</span>
00072 <span class="comment">        *****************************************************************************/</span>
00073     <a class="code" href="structPVRTVec2.html#a0">PVRTVec2</a>(VERTTYPE fValue) : x(fValue), y(fValue) {}
00074     <span class="comment">/*!***************************************************************************</span>
00075 <span class="comment">        @Function           PVRTVec2</span>
00076 <span class="comment">        @Input              pVec    an array</span>
<a name="l00077"></a><a class="code" href="structPVRTVec2.html#a2">00077</a> <span class="comment">        @Description        Constructor from an array</span>
00078 <span class="comment">        *****************************************************************************/</span>
00079     <a class="code" href="structPVRTVec2.html#a0">PVRTVec2</a>(<span class="keyword">const</span> VERTTYPE* pVec) : x(pVec[0]), y(pVec[1]) {}
00080     <span class="comment">/*!***************************************************************************</span>
00081 <span class="comment">        @Function           PVRTVec2</span>
00082 <span class="comment">        @Input              v3Vec a Vec3</span>
00083 <span class="comment">        @Description        Constructor from a Vec3</span>
<a name="l00084"></a><a class="code" href="structPVRTVec2.html#a3">00084</a> <span class="comment">        *****************************************************************************/</span>
00085     <a class="code" href="structPVRTVec2.html#a0">PVRTVec2</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; v3Vec);
00086     <span class="comment">/*!***************************************************************************</span>
00087 <span class="comment">        ** Operators</span>
00088 <span class="comment">        ****************************************************************************/</span>
00089     <span class="comment">/*!***************************************************************************</span>
00090 <span class="comment">        @Function           +</span>
00091 <span class="comment">        @Input              rhs another Vec2</span>
00092 <span class="comment">        @Returns            result of addition</span>
00093 <span class="comment">        @Description        componentwise addition operator for two Vec2s</span>
00094 <span class="comment">        *****************************************************************************/</span>
00095     <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#a5">operator+</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)<span class="keyword"> const</span>
00096 <span class="keyword">    </span>{
00097         <a class="code" href="structPVRTVec2.html">PVRTVec2</a> out(*<span class="keyword">this</span>);
00098         <span class="keywordflow">return</span> out += rhs;
00099     }
00100     <span class="comment">/*!***************************************************************************</span>
00101 <span class="comment">        @Function           -</span>
<a name="l00102"></a><a class="code" href="structPVRTVec2.html#a5">00102</a> <span class="comment">        @Input              rhs another Vec2</span>
00103 <span class="comment">        @Returns            result of subtraction</span>
00104 <span class="comment">        @Description        componentwise subtraction operator for two Vec2s</span>
00105 <span class="comment">        ****************************************************************************/</span>
00106     <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#a6">operator-</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)<span class="keyword"> const</span>
00107 <span class="keyword">    </span>{
00108         <a class="code" href="structPVRTVec2.html">PVRTVec2</a> out(*<span class="keyword">this</span>);
00109         <span class="keywordflow">return</span> out -= rhs;
00110     }
00111 
00112     <span class="comment">/*!***************************************************************************</span>
00113 <span class="comment">        @Function           +=</span>
<a name="l00114"></a><a class="code" href="structPVRTVec2.html#a6">00114</a> <span class="comment">        @Input              rhs another Vec2</span>
00115 <span class="comment">        @Returns            result of addition</span>
00116 <span class="comment">        @Description        componentwise addition and assignment operator for two Vec2s</span>
00117 <span class="comment">        ****************************************************************************/</span>
00118     <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; <a class="code" href="structPVRTVec2.html#a7">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)
00119     {
00120         x += rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>;
00121         y += rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>;
00122         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00123     }
00124 
00125     <span class="comment">/*!***************************************************************************</span>
00126 <span class="comment">        @Function           -=</span>
<a name="l00127"></a><a class="code" href="structPVRTVec2.html#a7">00127</a> <span class="comment">        @Input              rhs another Vec2</span>
00128 <span class="comment">        @Returns            result of subtraction</span>
00129 <span class="comment">        @Description        componentwise subtraction and assignment operator for two Vec2s</span>
00130 <span class="comment">        ****************************************************************************/</span>
00131     <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; <a class="code" href="structPVRTVec2.html#a8">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)
00132     {
00133         x -= rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>;
00134         y -= rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>;
00135         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00136     }
00137 
00138     <span class="comment">/*!***************************************************************************</span>
00139 <span class="comment">        @Function           -</span>
00140 <span class="comment">        @Input              rhs another Vec2</span>
<a name="l00141"></a><a class="code" href="structPVRTVec2.html#a8">00141</a> <span class="comment">        @Returns            result of negation</span>
00142 <span class="comment">        @Description        negation operator for a Vec2</span>
00143 <span class="comment">        ****************************************************************************/</span>
00144     <span class="keyword">friend</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#a6">operator- </a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs) { <span class="keywordflow">return</span> <a class="code" href="structPVRTVec2.html#a0">PVRTVec2</a>(-rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>, -rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>); }
00145 
00146     <span class="comment">/*!***************************************************************************</span>
00147 <span class="comment">        @Function           *</span>
00148 <span class="comment">        @Input              lhs scalar</span>
00149 <span class="comment">        @Input              rhs a Vec2</span>
00150 <span class="comment">        @Returns            result of multiplication</span>
00151 <span class="comment">        @Description        multiplication operator for a Vec2</span>
00152 <span class="comment">        ****************************************************************************/</span>
00153     <span class="keyword">friend</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#n1">operator*</a>(<span class="keyword">const</span> VERTTYPE lhs, <span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp;  rhs)
00154     {
<a name="l00155"></a><a class="code" href="structPVRTVec2.html#n0">00155</a>         <a class="code" href="structPVRTVec2.html">PVRTVec2</a> out(lhs);
00156         <span class="keywordflow">return</span> out *= rhs;
00157     }
00158 
00159     <span class="comment">/*!***************************************************************************</span>
00160 <span class="comment">        @Function           /</span>
00161 <span class="comment">        @Input              lhs scalar</span>
00162 <span class="comment">        @Input              rhs a Vec2</span>
00163 <span class="comment">        @Returns            result of division</span>
00164 <span class="comment">        @Description        division operator for scalar and Vec2</span>
<a name="l00165"></a><a class="code" href="structPVRTVec2.html#n1">00165</a> <span class="comment">        ****************************************************************************/</span>
00166     <span class="keyword">friend</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#n2">operator/</a>(<span class="keyword">const</span> VERTTYPE lhs, <span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp;  rhs)
00167     {
00168         <a class="code" href="structPVRTVec2.html">PVRTVec2</a> out(lhs);
00169         <span class="keywordflow">return</span> out /= rhs;
00170     }
00171 
00172     <span class="comment">/*!***************************************************************************</span>
00173 <span class="comment">        @Function           *</span>
00174 <span class="comment">        @Input              rhs a scalar</span>
00175 <span class="comment">        @Returns            result of multiplication</span>
00176 <span class="comment">        @Description        componentwise multiplication by scalar for Vec2</span>
00177 <span class="comment">        ****************************************************************************/</span>
00178     <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#n1">operator*</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)<span class="keyword"> const</span>
<a name="l00179"></a><a class="code" href="structPVRTVec2.html#n2">00179</a> <span class="keyword">    </span>{
00180         <a class="code" href="structPVRTVec2.html">PVRTVec2</a> out(*<span class="keyword">this</span>);
00181         <span class="keywordflow">return</span> out *= rhs;
00182     }
00183 
00184     <span class="comment">/*!***************************************************************************</span>
00185 <span class="comment">        @Function           *=</span>
00186 <span class="comment">        @Input              rhs a scalar</span>
00187 <span class="comment">        @Returns            result of multiplication and assignment</span>
00188 <span class="comment">        @Description        componentwise multiplication and assignment by scalar for Vec2</span>
00189 <span class="comment">        ****************************************************************************/</span>
00190     <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; <a class="code" href="structPVRTVec2.html#a10">operator*=</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)
00191     {
<a name="l00192"></a><a class="code" href="structPVRTVec2.html#a9">00192</a>         x = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x, rhs);
00193         y = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y, rhs);
00194         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00195     }
00196 
00197     <span class="comment">/*!***************************************************************************</span>
00198 <span class="comment">        @Function           *=</span>
00199 <span class="comment">        @Input              rhs a Vec2</span>
00200 <span class="comment">        @Returns            result of multiplication and assignment</span>
00201 <span class="comment">        @Description        componentwise multiplication and assignment by Vec2 for Vec2</span>
00202 <span class="comment">        ****************************************************************************/</span>
00203     <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; <a class="code" href="structPVRTVec2.html#a10">operator*=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)
00204     {
<a name="l00205"></a><a class="code" href="structPVRTVec2.html#a10">00205</a>         x = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x, rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>);
00206         y = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y, rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>);
00207         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00208     }
00209 
00210     <span class="comment">/*!***************************************************************************</span>
00211 <span class="comment">        @Function           /</span>
00212 <span class="comment">        @Input              rhs a scalar</span>
00213 <span class="comment">        @Returns            result of division</span>
00214 <span class="comment">        @Description        componentwise division by scalar for Vec2</span>
00215 <span class="comment">        ****************************************************************************/</span>
00216     <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#n2">operator/</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)<span class="keyword"> const</span>
00217 <span class="keyword">    </span>{
00218         <a class="code" href="structPVRTVec2.html">PVRTVec2</a> out(*<span class="keyword">this</span>);
<a name="l00219"></a><a class="code" href="structPVRTVec2.html#a11">00219</a>         <span class="keywordflow">return</span> out /= rhs;
00220     }
00221 
00222     <span class="comment">/*!***************************************************************************</span>
00223 <span class="comment">        @Function           /=</span>
00224 <span class="comment">        @Input              rhs a scalar</span>
00225 <span class="comment">        @Returns            result of division and assignment</span>
00226 <span class="comment">        @Description        componentwise division and assignment by scalar for Vec2</span>
00227 <span class="comment">        ****************************************************************************/</span>
00228     <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; <a class="code" href="structPVRTVec2.html#a13">operator/=</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)
00229     {
00230         x = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x, rhs);
00231         y = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y, rhs);
00232         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00233"></a><a class="code" href="structPVRTVec2.html#a12">00233</a>     }
00234 
00235     <span class="comment">/*!***************************************************************************</span>
00236 <span class="comment">        @Function           /=</span>
00237 <span class="comment">        @Input              rhs a Vec2</span>
00238 <span class="comment">        @Returns            result of division and assignment</span>
00239 <span class="comment">        @Description        componentwise division and assignment by Vec2 for Vec2</span>
00240 <span class="comment">        ****************************************************************************/</span>
00241     <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; <a class="code" href="structPVRTVec2.html#a13">operator/=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)
00242     {
00243         x = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x, rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>);
00244         y = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y, rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>);
00245         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00246"></a><a class="code" href="structPVRTVec2.html#a13">00246</a>     }
00247 
00248     <span class="comment">/*!***************************************************************************</span>
00249 <span class="comment">    @Function           ==</span>
00250 <span class="comment">    @Input              rhs a single value</span>
00251 <span class="comment">    @Returns            true if the two vectors are equal</span>
00252 <span class="comment">    @Description        PVRTVec2 equality operator</span>
00253 <span class="comment">    ****************************************************************************/</span>
00254     <span class="keywordtype">bool</span> <a class="code" href="structPVRTVec2.html#a15">operator==</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)<span class="keyword"> const</span>
00255 <span class="keyword">    </span>{
00256         <span class="keywordflow">return</span> ((x == rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>) &amp;&amp; (y == rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>));
00257     }
00258 
00259     <span class="comment">/*!***************************************************************************</span>
<a name="l00260"></a><a class="code" href="structPVRTVec2.html#a14">00260</a> <span class="comment">    @Function           !=</span>
00261 <span class="comment">    @Input              rhs a single value</span>
00262 <span class="comment">    @Returns            true if the two vectors are not equal</span>
00263 <span class="comment">    @Description        PVRTVec2 inequality operator</span>
00264 <span class="comment">    ****************************************************************************/</span>
00265     <span class="keywordtype">bool</span> <a class="code" href="structPVRTVec2.html#a16">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)<span class="keyword"> const</span>
00266 <span class="keyword">    </span>{
00267         <span class="keywordflow">return</span> ((x != rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>) || (y != rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>));
00268     }
00269 
00270     <span class="comment">// FUNCTIONS</span>
00271     <span class="comment">/*!***************************************************************************</span>
00272 <span class="comment">        @Function           lenSqr</span>
00273 <span class="comment">        @Returns            the square of the magnitude of the vector</span>
<a name="l00274"></a><a class="code" href="structPVRTVec2.html#a15">00274</a> <span class="comment">        @Description        calculates the square of the magnitude of the vector</span>
00275 <span class="comment">        ****************************************************************************/</span>
00276     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec2.html#a17">lenSqr</a>()<span class="keyword"> const</span>
00277 <span class="keyword">    </span>{
00278         <span class="keywordflow">return</span> <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,x)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,y);
00279     }
00280 
00281     <span class="comment">/*!***************************************************************************</span>
00282 <span class="comment">        @Function           length</span>
00283 <span class="comment">        @Returns            the of the magnitude of the vector</span>
00284 <span class="comment">        @Description        calculates the magnitude of the vector</span>
00285 <span class="comment">        ****************************************************************************/</span>
<a name="l00286"></a><a class="code" href="structPVRTVec2.html#a16">00286</a>     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec2.html#a18">length</a>()<span class="keyword"> const</span>
00287 <span class="keyword">    </span>{
00288         <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>) <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(sqrt(<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(x)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(x) + <a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(y)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(y)));
00289     }
00290 
00291     <span class="comment">/*!***************************************************************************</span>
00292 <span class="comment">        @Function           normalize</span>
00293 <span class="comment">        @Returns            the normalized value of the vector</span>
00294 <span class="comment">        @Description        normalizes the vector</span>
00295 <span class="comment">        ****************************************************************************/</span>
00296     <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#a19">normalize</a>()
00297     {
<a name="l00298"></a><a class="code" href="structPVRTVec2.html#a17">00298</a>         <span class="keywordflow">return</span> *<span class="keyword">this</span> /= <a class="code" href="structPVRTVec2.html#a18">length</a>();
00299     }
00300 
00301     <span class="comment">/*!***************************************************************************</span>
00302 <span class="comment">        @Function           normalized</span>
00303 <span class="comment">        @Returns            returns the normalized value of the vector</span>
00304 <span class="comment">        @Description        returns a normalized vector of the same direction as this</span>
00305 <span class="comment">        vector</span>
00306 <span class="comment">        ****************************************************************************/</span>
00307     <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#a20">normalized</a>()<span class="keyword"> const</span>
00308 <span class="keyword">    </span>{
<a name="l00309"></a><a class="code" href="structPVRTVec2.html#a18">00309</a>         <a class="code" href="structPVRTVec2.html">PVRTVec2</a> out(*<span class="keyword">this</span>);
00310         <span class="keywordflow">return</span> out.<a class="code" href="structPVRTVec2.html#a19">normalize</a>();
00311     }
00312 
00313     <span class="comment">/*!***************************************************************************</span>
00314 <span class="comment">        @Function           rotated90</span>
00315 <span class="comment">        @Returns            returns the vector rotated 90�</span>
00316 <span class="comment">        @Description        returns the vector rotated 90�</span>
00317 <span class="comment">        ****************************************************************************/</span>
00318     <a class="code" href="structPVRTVec2.html">PVRTVec2</a> <a class="code" href="structPVRTVec2.html#a21">rotated90</a>()<span class="keyword"> const</span>
00319 <span class="keyword">    </span>{
<a name="l00320"></a><a class="code" href="structPVRTVec2.html#a19">00320</a>         <span class="keywordflow">return</span> <a class="code" href="structPVRTVec2.html#a0">PVRTVec2</a>(-y, x);
00321     }
00322 
00323     <span class="comment">/*!***************************************************************************</span>
00324 <span class="comment">        @Function           dot</span>
00325 <span class="comment">        @Input              rhs a single value</span>
00326 <span class="comment">        @Returns            scalar product</span>
00327 <span class="comment">        @Description        calculate the scalar product of two Vec3s</span>
00328 <span class="comment">        ****************************************************************************/</span>
00329     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec2.html#a22">dot</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec2.html">PVRTVec2</a>&amp; rhs)<span class="keyword"> const</span>
00330 <span class="keyword">    </span>{
00331         <span class="keywordflow">return</span> <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x, rhs.<a class="code" href="structPVRTVec2.html#o0">x</a>) + <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y, rhs.<a class="code" href="structPVRTVec2.html#o1">y</a>);
<a name="l00332"></a><a class="code" href="structPVRTVec2.html#a20">00332</a>     }
00333 
00334     <span class="comment">/*!***************************************************************************</span>
00335 <span class="comment">        @Function           ptr</span>
00336 <span class="comment">        @Returns            pointer</span>
00337 <span class="comment">        @Description        returns a pointer to memory containing the values of the</span>
00338 <span class="comment">        Vec3</span>
00339 <span class="comment">        ****************************************************************************/</span>
00340     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *<a class="code" href="structPVRTVec2.html#a23">ptr</a>() { <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>*)<span class="keyword">this</span>; }
00341 };
00342 
00343 <span class="comment">/*!***************************************************************************</span>
<a name="l00344"></a><a class="code" href="structPVRTVec2.html#a21">00344</a> <span class="comment">** PVRTVec3 3 component vector</span>
00345 <span class="comment">****************************************************************************/</span>
00346 <span class="keyword">struct </span><a class="code" href="structPVRTVec3.html">PVRTVec3</a> : <span class="keyword">public</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a>
00347 {
00348 <span class="comment">/*!***************************************************************************</span>
00349 <span class="comment">** Constructors</span>
00350 <span class="comment">****************************************************************************/</span>
00351 <span class="comment">/*!***************************************************************************</span>
00352 <span class="comment"> @Function          PVRTVec3</span>
00353 <span class="comment"> @Description       Blank constructor.</span>
00354 <span class="comment">*****************************************************************************/</span>
00355     <a class="code" href="structPVRTVec3.html#a0">PVRTVec3</a>(){}
<a name="l00356"></a><a class="code" href="structPVRTVec2.html#a22">00356</a> <span class="comment">/*!***************************************************************************</span>
00357 <span class="comment"> @Function          PVRTVec3</span>
00358 <span class="comment"> @Input             fX  X component of vector</span>
00359 <span class="comment"> @Input             fY  Y component of vector</span>
00360 <span class="comment"> @Input             fZ  Z component of vector</span>
00361 <span class="comment"> @Description       Simple constructor from 3 values.</span>
00362 <span class="comment">*****************************************************************************/</span>
00363     <a class="code" href="structPVRTVec3.html#a0">PVRTVec3</a>(VERTTYPE fX, VERTTYPE fY, VERTTYPE fZ)
00364     {
00365         x = fX; y = fY; z = fZ;
00366     }
00367 <span class="comment">/*!***************************************************************************</span>
<a name="l00368"></a><a class="code" href="structPVRTVec2.html#a23">00368</a> <span class="comment"> @Function          PVRTVec3</span>
00369 <span class="comment"> @Input             fValue  a component value</span>
00370 <span class="comment"> @Description       Constructor from a single value.</span>
00371 <span class="comment">*****************************************************************************/</span>
00372     <a class="code" href="structPVRTVec3.html#a0">PVRTVec3</a>(<span class="keyword">const</span> VERTTYPE fValue)
00373     {
<a name="l00374"></a><a class="code" href="structPVRTVec3.html">00374</a>         x = fValue; y = fValue; z = fValue;
00375     }
00376 <span class="comment">/*!***************************************************************************</span>
00377 <span class="comment"> @Function          PVRTVec3</span>
00378 <span class="comment"> @Input             pVec    an array</span>
00379 <span class="comment"> @Description       Constructor from an array</span>
00380 <span class="comment">*****************************************************************************/</span>
00381     <a class="code" href="structPVRTVec3.html#a0">PVRTVec3</a>(<span class="keyword">const</span> VERTTYPE* pVec)
00382     {
00383         x = (*pVec++); y = (*pVec++); z = *pVec;
<a name="l00384"></a><a class="code" href="structPVRTVec3.html#a0">00384</a>     }
00385 <span class="comment">/*!***************************************************************************</span>
00386 <span class="comment"> @Function          PVRTVec3</span>
00387 <span class="comment"> @Input             v4Vec a PVRTVec4</span>
00388 <span class="comment"> @Description       Constructor from a PVRTVec4</span>
00389 <span class="comment">*****************************************************************************/</span>
00390     <a class="code" href="structPVRTVec3.html#a0">PVRTVec3</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; v4Vec);
00391 <span class="comment">/*!***************************************************************************</span>
00392 <span class="comment">** Operators</span>
<a name="l00393"></a><a class="code" href="structPVRTVec3.html#a1">00393</a> <span class="comment">****************************************************************************/</span>
00394 <span class="comment">/*!***************************************************************************</span>
00395 <span class="comment"> @Function          +</span>
00396 <span class="comment"> @Input             rhs another PVRTVec3</span>
00397 <span class="comment"> @Returns           result of addition</span>
00398 <span class="comment"> @Description       componentwise addition operator for two PVRTVec3s</span>
00399 <span class="comment">*****************************************************************************/</span>
00400     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#a5">operator+</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)<span class="keyword"> const</span>
00401 <span class="keyword">    </span>{
00402         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
<a name="l00403"></a><a class="code" href="structPVRTVec3.html#a2">00403</a>         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = x+rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>;
00404         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = y+rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>;
00405         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = z+rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;
00406         <span class="keywordflow">return</span> out;
00407     }
00408 <span class="comment">/*!***************************************************************************</span>
00409 <span class="comment"> @Function          -</span>
00410 <span class="comment"> @Input             rhs another PVRTVec3</span>
00411 <span class="comment"> @Returns           result of subtraction</span>
00412 <span class="comment"> @Description       componentwise subtraction operator for two PVRTVec3s</span>
<a name="l00413"></a><a class="code" href="structPVRTVec3.html#a3">00413</a> <span class="comment">****************************************************************************/</span>
00414     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#a6">operator-</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)<span class="keyword"> const</span>
00415 <span class="keyword">    </span>{
00416         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
00417         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = x-rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>;
00418         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = y-rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>;
00419         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = z-rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;
00420         <span class="keywordflow">return</span> out;
00421     }
00422 
00423 <span class="comment">/*!***************************************************************************</span>
00424 <span class="comment"> @Function          +=</span>
00425 <span class="comment"> @Input             rhs another PVRTVec3</span>
00426 <span class="comment"> @Returns           result of addition</span>
00427 <span class="comment"> @Description       componentwise addition and assignement operator for two PVRTVec3s</span>
00428 <span class="comment">****************************************************************************/</span>
00429     <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; <a class="code" href="structPVRTVec3.html#a7">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)
00430     {
00431         x +=rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>;
00432         y +=rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>;
00433         z +=rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;
<a name="l00434"></a><a class="code" href="structPVRTVec3.html#a5">00434</a>         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00435     }
00436 
00437 <span class="comment">/*!***************************************************************************</span>
00438 <span class="comment"> @Function          -=</span>
00439 <span class="comment"> @Input             rhs another PVRTVec3</span>
00440 <span class="comment"> @Returns           result of subtraction</span>
00441 <span class="comment"> @Description       componentwise subtraction and assignement operator for two PVRTVec3s</span>
00442 <span class="comment">****************************************************************************/</span>
00443     <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; <a class="code" href="structPVRTVec3.html#a8">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)
00444     {
00445         x -=rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>;
00446         y -=rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>;
00447         z -=rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;
00448         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00449"></a><a class="code" href="structPVRTVec3.html#a6">00449</a>     }
00450 
00451 <span class="comment">/*!***************************************************************************</span>
00452 <span class="comment"> @Function          -</span>
00453 <span class="comment"> @Input             rhs another PVRTVec3</span>
00454 <span class="comment"> @Returns           result of negation</span>
00455 <span class="comment"> @Description       negation operator for a PVRTVec3</span>
00456 <span class="comment">****************************************************************************/</span>
00457     <span class="keyword">friend</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#a6">operator - </a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs) { <span class="keywordflow">return</span> <a class="code" href="structPVRTVec3.html#a0">PVRTVec3</a>(rhs) *= <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(-1); }
00458 
00459 <span class="comment">/*!***************************************************************************</span>
00460 <span class="comment"> @Function          *</span>
00461 <span class="comment"> @Input             lhs single value</span>
00462 <span class="comment"> @Input             rhs a PVRTVec3</span>
00463 <span class="comment"> @Returns           result of multiplication</span>
00464 <span class="comment"> @Description       multiplication operator for a PVRTVec3</span>
<a name="l00465"></a><a class="code" href="structPVRTVec3.html#a7">00465</a> <span class="comment">****************************************************************************/</span>
00466     <span class="keyword">friend</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#n1">operator*</a>(<span class="keyword">const</span> VERTTYPE lhs, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp;  rhs)
00467     {
00468         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
00469         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>);
00470         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>);
00471         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>);
00472         <span class="keywordflow">return</span> out;
00473     }
00474 
00475 <span class="comment">/*!***************************************************************************</span>
00476 <span class="comment"> @Function          *</span>
00477 <span class="comment"> @Input             lhs single value</span>
00478 <span class="comment"> @Input             rhs a PVRTVec3</span>
00479 <span class="comment"> @Returns           result of negation</span>
<a name="l00480"></a><a class="code" href="structPVRTVec3.html#a8">00480</a> <span class="comment"> @Description       negation operator for a PVRTVec3</span>
00481 <span class="comment">****************************************************************************/</span>
00482     <span class="keyword">friend</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#n2">operator/</a>(<span class="keyword">const</span> VERTTYPE lhs, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp;  rhs)
00483     {
00484         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
00485         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>);
00486         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>);
00487         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>);
00488         <span class="keywordflow">return</span> out;
00489     }
00490 
00491 <span class="comment">/*!***************************************************************************</span>
00492 <span class="comment"> @Function          *</span>
00493 <span class="comment"> @Input             rhs a PVRTMat3</span>
00494 <span class="comment"> @Returns           result of multiplication</span>
<a name="l00495"></a><a class="code" href="structPVRTVec3.html#n0">00495</a> <span class="comment"> @Description       matrix multiplication operator PVRTVec3 and PVRTMat3</span>
00496 <span class="comment">****************************************************************************/</span>
00497     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#n1">operator*</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs) <span class="keyword">const</span>;
00498 
00499 <span class="comment">/*!***************************************************************************</span>
00500 <span class="comment"> @Function          *=</span>
00501 <span class="comment"> @Input             rhs a PVRTMat3</span>
00502 <span class="comment"> @Returns           result of multiplication and assignment</span>
00503 <span class="comment"> @Description       matrix multiplication and assignment operator for PVRTVec3 and PVRTMat3</span>
00504 <span class="comment">****************************************************************************/</span>
<a name="l00505"></a><a class="code" href="structPVRTVec3.html#n1">00505</a>     <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; <a class="code" href="structPVRTVec3.html#a10">operator*=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs);
00506 
00507 <span class="comment">/*!***************************************************************************</span>
00508 <span class="comment"> @Function          *</span>
00509 <span class="comment"> @Input             rhs a single value</span>
00510 <span class="comment"> @Returns           result of multiplication</span>
00511 <span class="comment"> @Description       componentwise multiplication by single dimension value for PVRTVec3</span>
00512 <span class="comment">****************************************************************************/</span>
00513     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#n1">operator*</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)<span class="keyword"> const</span>
00514 <span class="keyword">    </span>{
00515         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
00516         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs);
00517         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs);
00518         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs);
00519         <span class="keywordflow">return</span> out;
00520     }
00521 
<a name="l00522"></a><a class="code" href="structPVRTVec3.html#n2">00522</a> <span class="comment">/*!***************************************************************************</span>
00523 <span class="comment"> @Function          *</span>
00524 <span class="comment"> @Input             rhs a single value</span>
00525 <span class="comment"> @Returns           result of multiplication and assignment</span>
00526 <span class="comment"> @Description       componentwise multiplication and assignement by single</span>
00527 <span class="comment">                    dimension value for PVRTVec3</span>
00528 <span class="comment">****************************************************************************/</span>
00529     <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; <a class="code" href="structPVRTVec3.html#a10">operator*=</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)
00530     {
00531         x = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs);
00532         y = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs);
00533         z = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs);
00534         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00535     }
00536 
00537 <span class="comment">/*!***************************************************************************</span>
00538 <span class="comment"> @Function          /</span>
00539 <span class="comment"> @Input             rhs a single value</span>
00540 <span class="comment"> @Returns           result of division</span>
00541 <span class="comment"> @Description       componentwise division by single</span>
00542 <span class="comment">                    dimension value for PVRTVec3</span>
00543 <span class="comment">****************************************************************************/</span>
00544     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#n2">operator/</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)<span class="keyword"> const</span>
00545 <span class="keyword">    </span>{
00546         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
00547         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,rhs);
00548         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,rhs);
00549         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,rhs);
00550         <span class="keywordflow">return</span> out;
00551     }
00552 
00553 <span class="comment">/*!***************************************************************************</span>
00554 <span class="comment"> @Function          /=</span>
00555 <span class="comment"> @Input             rhs a single value</span>
<a name="l00556"></a><a class="code" href="structPVRTVec3.html#a11">00556</a> <span class="comment"> @Returns           result of division and assignment</span>
00557 <span class="comment"> @Description       componentwise division and assignement by single</span>
00558 <span class="comment">                    dimension value for PVRTVec3</span>
00559 <span class="comment">****************************************************************************/</span>
00560     <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; <a class="code" href="structPVRTVec3.html#a14">operator/=</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)
00561     {
00562         x = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,rhs);
00563         y = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,rhs);
00564         z = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,rhs);
00565         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00566     }
00567 
00568 <span class="comment">/*!***************************************************************************</span>
00569 <span class="comment"> @Function          ==</span>
00570 <span class="comment"> @Input             rhs a single value</span>
00571 <span class="comment"> @Returns           true if the two vectors are equal</span>
00572 <span class="comment"> @Description       PVRTVec3 equality operator</span>
<a name="l00573"></a><a class="code" href="structPVRTVec3.html#a12">00573</a> <span class="comment">****************************************************************************/</span>
00574     <span class="keywordtype">bool</span> <a class="code" href="structPVRTVec3.html#a15">operator==</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)<span class="keyword"> const</span>
00575 <span class="keyword">    </span>{
00576         <span class="keywordflow">return</span> ((x == rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>) &amp;&amp; (y == rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>) &amp;&amp; (z == rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>));
00577     }
00578 
00579 <span class="comment">/*!***************************************************************************</span>
00580 <span class="comment">@Function           !=</span>
00581 <span class="comment">@Input              rhs a single value</span>
00582 <span class="comment">@Returns            true if the two vectors are not equal</span>
00583 <span class="comment">@Description        PVRTVec3 inequality operator</span>
00584 <span class="comment">    ****************************************************************************/</span>
00585     <span class="keywordtype">bool</span> <a class="code" href="structPVRTVec3.html#a16">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)<span class="keyword"> const</span>
00586 <span class="keyword">    </span>{
00587         <span class="keywordflow">return</span> ((x != rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>) || (y != rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>) || (z != rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>));
00588     }
<a name="l00589"></a><a class="code" href="structPVRTVec3.html#a13">00589</a>     <span class="comment">// FUNCTIONS</span>
00590 <span class="comment">/*!***************************************************************************</span>
00591 <span class="comment"> @Function          lenSqr</span>
00592 <span class="comment"> @Returns           the square of the magnitude of the vector</span>
00593 <span class="comment"> @Description       calculates the square of the magnitude of the vector</span>
00594 <span class="comment">****************************************************************************/</span>
00595     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec3.html#a17">lenSqr</a>()<span class="keyword"> const</span>
00596 <span class="keyword">    </span>{
00597         <span class="keywordflow">return</span> <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,x)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,y)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,z);
00598     }
00599 
00600 <span class="comment">/*!***************************************************************************</span>
00601 <span class="comment"> @Function          length</span>
00602 <span class="comment"> @Returns           the of the magnitude of the vector</span>
00603 <span class="comment"> @Description       calculates the magnitude of the vector</span>
00604 <span class="comment">****************************************************************************/</span>
00605     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec3.html#a18">length</a>()<span class="keyword"> const</span>
<a name="l00606"></a><a class="code" href="structPVRTVec3.html#a14">00606</a> <span class="keyword">    </span>{
00607         <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>) <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(sqrt(<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(x)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(x) + <a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(y)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(y) + <a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(z)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(z)));
00608     }
00609 
00610 <span class="comment">/*!***************************************************************************</span>
00611 <span class="comment"> @Function          normalize</span>
00612 <span class="comment"> @Returns           the normalized value of the vector</span>
00613 <span class="comment"> @Description       normalizes the vector</span>
00614 <span class="comment">****************************************************************************/</span>
00615     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#a19">normalize</a>()
00616     {
00617 <span class="preprocessor">#if defined(PVRT_FIXED_POINT_ENABLE)</span>
00618 <span class="preprocessor"></span>        <span class="comment">// Scale vector by uniform value</span>
00619         <span class="keywordtype">int</span> n = <a class="code" href="PVRTFixedPoint_8h.html#a5">PVRTABS</a>(x) + <a class="code" href="PVRTFixedPoint_8h.html#a5">PVRTABS</a>(y) + <a class="code" href="PVRTFixedPoint_8h.html#a5">PVRTABS</a>(z);
00620         x = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x, n);
<a name="l00621"></a><a class="code" href="structPVRTVec3.html#a15">00621</a>         y = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y, n);
00622         z = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z, n);
00623 
00624         <span class="comment">// Calculate x2+y2+z2/sqrt(x2+y2+z2)</span>
00625         <span class="keywordtype">int</span> f = <a class="code" href="structPVRTVec3.html#a21">dot</a>(*<span class="keyword">this</span>);
00626         f = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(<a class="code" href="PVRTFixedPoint_8h.html#a1">PVRTF2X</a>(1.0f), <a class="code" href="PVRTFixedPoint_8h.html#a1">PVRTF2X</a>(sqrt(<a class="code" href="PVRTFixedPoint_8h.html#a2">PVRTX2F</a>(f))));
00627 
00628         <span class="comment">// Multiply vector components by f</span>
00629         x = <a class="code" href="PVRTFixedPoint_8h.html#a3">PVRTXMUL</a>(x, f);
00630         y = <a class="code" href="PVRTFixedPoint_8h.html#a3">PVRTXMUL</a>(y, f);
00631         z = <a class="code" href="PVRTFixedPoint_8h.html#a3">PVRTXMUL</a>(z, f);
00632 <span class="preprocessor">#else</span>
<a name="l00633"></a><a class="code" href="structPVRTVec3.html#a16">00633</a> <span class="preprocessor"></span>        <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> len = <a class="code" href="structPVRTVec3.html#a18">length</a>();
00634         x =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,len);
00635         y =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,len);
00636         z =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,len);
00637 <span class="preprocessor">#endif</span>
00638 <span class="preprocessor"></span>        <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00639     }
00640 
00641 <span class="comment">/*!***************************************************************************</span>
00642 <span class="comment"> @Function          normalized</span>
00643 <span class="comment"> @Returns           returns the normalized value of the vector</span>
<a name="l00644"></a><a class="code" href="structPVRTVec3.html#a17">00644</a> <span class="comment"> @Description       returns a normalized vector of the same direction as this</span>
00645 <span class="comment">                    vector</span>
00646 <span class="comment">****************************************************************************/</span>
00647     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#a20">normalized</a>()<span class="keyword"> const</span>
00648 <span class="keyword">    </span>{
00649         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
00650 <span class="preprocessor">#if defined(PVRT_FIXED_POINT_ENABLE)</span>
00651 <span class="preprocessor"></span>        <span class="comment">// Scale vector by uniform value</span>
00652         <span class="keywordtype">int</span> n = <a class="code" href="PVRTFixedPoint_8h.html#a5">PVRTABS</a>(x) + <a class="code" href="PVRTFixedPoint_8h.html#a5">PVRTABS</a>(y) + <a class="code" href="PVRTFixedPoint_8h.html#a5">PVRTABS</a>(z);
00653         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x, n);
00654         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y, n);
<a name="l00655"></a><a class="code" href="structPVRTVec3.html#a18">00655</a>         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z, n);
00656 
00657         <span class="comment">// Calculate x2+y2+z2/sqrt(x2+y2+z2)</span>
00658         <span class="keywordtype">int</span> f = out.<a class="code" href="structPVRTVec3.html#a21">dot</a>(out);
00659         f = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(<a class="code" href="PVRTFixedPoint_8h.html#a1">PVRTF2X</a>(1.0f), <a class="code" href="PVRTFixedPoint_8h.html#a1">PVRTF2X</a>(sqrt(<a class="code" href="PVRTFixedPoint_8h.html#a2">PVRTX2F</a>(f))));
00660 
00661         <span class="comment">// Multiply vector components by f</span>
00662         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a3">PVRTXMUL</a>(out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>, f);
00663         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a3">PVRTXMUL</a>(out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>, f);
00664         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a3">PVRTXMUL</a>(out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>, f);
00665 <span class="preprocessor">#else</span>
<a name="l00666"></a><a class="code" href="structPVRTVec3.html#a19">00666</a> <span class="preprocessor"></span>        <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> len = <a class="code" href="structPVRTVec3.html#a18">length</a>();
00667         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,len);
00668         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,len);
00669         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,len);
00670 <span class="preprocessor">#endif</span>
00671 <span class="preprocessor"></span>        <span class="keywordflow">return</span> out;
00672     }
00673 
00674 <span class="comment">/*!***************************************************************************</span>
00675 <span class="comment"> @Function          dot</span>
00676 <span class="comment"> @Input             rhs a single value</span>
00677 <span class="comment"> @Returns           scalar product</span>
00678 <span class="comment"> @Description       calculate the scalar product of two PVRTVec3s</span>
00679 <span class="comment">****************************************************************************/</span>
00680     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec3.html#a21">dot</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)<span class="keyword"> const</span>
00681 <span class="keyword">    </span>{
00682         <span class="keywordflow">return</span> <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>);
00683     }
00684 
00685 <span class="comment">/*!***************************************************************************</span>
00686 <span class="comment"> @Function          cross</span>
00687 <span class="comment"> @Returns           returns three-dimensional vector</span>
00688 <span class="comment"> @Description       calculate the cross product of two PVRTVec3s</span>
00689 <span class="comment">****************************************************************************/</span>
00690     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTVec3.html#a22">cross</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)<span class="keyword"> const</span>
00691 <span class="keyword">    </span>{
00692         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
00693         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>)-<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>);
00694         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>)-<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>);
00695         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>)-<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>);
00696         <span class="keywordflow">return</span> out;
00697     }
00698 
<a name="l00699"></a><a class="code" href="structPVRTVec3.html#a20">00699</a> <span class="comment">/*!***************************************************************************</span>
00700 <span class="comment"> @Function          ptr</span>
00701 <span class="comment"> @Returns           pointer</span>
00702 <span class="comment"> @Description       returns a pointer to memory containing the values of the</span>
00703 <span class="comment">                    PVRTVec3</span>
00704 <span class="comment">****************************************************************************/</span>
00705     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *<a class="code" href="structPVRTVec3.html#a23">ptr</a>() { <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>*)<span class="keyword">this</span>; }
00706 };
00707 
00708 <span class="comment">/*!***************************************************************************</span>
00709 <span class="comment">** PVRTVec4 4 component vector</span>
00710 <span class="comment">****************************************************************************/</span>
00711 <span class="keyword">struct </span><a class="code" href="structPVRTVec4.html">PVRTVec4</a> : <span class="keyword">public</span> <a class="code" href="structPVRTVECTOR4f.html">PVRTVECTOR4</a>
00712 {
00713 <span class="comment">/*!***************************************************************************</span>
00714 <span class="comment">** Constructors</span>
00715 <span class="comment">****************************************************************************/</span>
00716 <span class="comment">/*!***************************************************************************</span>
00717 <span class="comment"> @Function          PVRTVec4</span>
00718 <span class="comment"> @Description       Blank constructor.</span>
00719 <span class="comment">*****************************************************************************/</span>
00720     <a class="code" href="structPVRTVec4.html#a0">PVRTVec4</a>(){}
00721 
00722 <span class="comment">/*!***************************************************************************</span>
00723 <span class="comment"> @Function          PVRTVec3</span>
00724 <span class="comment"> @Description       Blank constructor.</span>
00725 <span class="comment">*****************************************************************************/</span>
00726     <a class="code" href="structPVRTVec4.html#a0">PVRTVec4</a>(<span class="keyword">const</span> VERTTYPE vec)
00727     {
00728         <a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = vec; <a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = vec; <a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = vec; <a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = vec;
00729     }
00730 
00731 <span class="comment">/*!***************************************************************************</span>
00732 <span class="comment"> @Function          multiple value constructor</span>
<a name="l00733"></a><a class="code" href="structPVRTVec3.html#a21">00733</a> <span class="comment"> @Input             fX value of x component</span>
00734 <span class="comment"> @Input             fY value of y component</span>
00735 <span class="comment"> @Input             fZ value of z component</span>
00736 <span class="comment"> @Input             fW value of w component</span>
00737 <span class="comment"> @Description       Constructs a PVRTVec4 from 4 separate values</span>
00738 <span class="comment">****************************************************************************/</span>
00739     <a class="code" href="structPVRTVec4.html#a0">PVRTVec4</a>(VERTTYPE fX, VERTTYPE fY, VERTTYPE fZ, VERTTYPE fW)
00740     {
00741         x = fX; y = fY; z = fZ; w = fW;
00742     }
00743 
<a name="l00744"></a><a class="code" href="structPVRTVec3.html#a22">00744</a> <span class="comment">/*!***************************************************************************</span>
00745 <span class="comment"> @Function          constructor from PVRTVec3</span>
00746 <span class="comment"> @Input             vec3 a PVRTVec3</span>
00747 <span class="comment"> @Input             fW value of w component</span>
00748 <span class="comment"> @Description       Constructs a PVRTVec4 from a vec3 and a w component</span>
00749 <span class="comment">****************************************************************************/</span>
00750     <a class="code" href="structPVRTVec4.html#a0">PVRTVec4</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vec3, VERTTYPE fW)
00751     {
00752         x = vec3.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>; y = vec3.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>; z = vec3.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>; w = fW;
00753     }
00754 
00755 <span class="comment">/*!***************************************************************************</span>
00756 <span class="comment"> @Function          constructor from PVRTVec3</span>
00757 <span class="comment"> @Input             fX value of x component</span>
00758 <span class="comment"> @Input             vec3 a PVRTVec3</span>
00759 <span class="comment"> @Description       Constructs a vec4 from a vec3 and a w component</span>
<a name="l00760"></a><a class="code" href="structPVRTVec3.html#a23">00760</a> <span class="comment">****************************************************************************/</span>
00761     <a class="code" href="structPVRTVec4.html#a0">PVRTVec4</a>(VERTTYPE fX, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vec3)
00762     {
00763         x = fX; y = vec3.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>; z = vec3.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>; w = vec3.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;
00764     }
00765 
<a name="l00766"></a><a class="code" href="structPVRTVec4.html">00766</a> <span class="comment">/*!***************************************************************************</span>
00767 <span class="comment"> @Function          constructor from array</span>
00768 <span class="comment"> @Input             pVec a pointer to an array of four values</span>
00769 <span class="comment"> @Description       Constructs a PVRTVec4 from a pointer to an array of four values</span>
00770 <span class="comment">****************************************************************************/</span>
00771     <a class="code" href="structPVRTVec4.html#a0">PVRTVec4</a>(<span class="keyword">const</span> VERTTYPE* pVec)
00772     {
00773         x = (*pVec++); y = (*pVec++); z= (*pVec++); w = *pVec;
00774     }
00775 
<a name="l00776"></a><a class="code" href="structPVRTVec4.html#a0">00776</a> <span class="comment">/*!***************************************************************************</span>
00777 <span class="comment">** PVRTVec4 Operators</span>
00778 <span class="comment">****************************************************************************/</span>
00779 <span class="comment">/*!***************************************************************************</span>
00780 <span class="comment"> @Function          +</span>
00781 <span class="comment"> @Input             rhs another PVRTVec4</span>
00782 <span class="comment"> @Returns           result of addition</span>
<a name="l00783"></a><a class="code" href="structPVRTVec4.html#a1">00783</a> <span class="comment"> @Description       Addition operator for PVRTVec4</span>
00784 <span class="comment">****************************************************************************/</span>
00785     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a6">operator+</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)<span class="keyword"> const</span>
00786 <span class="keyword">    </span>{
00787         <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
00788         out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = x+rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>;
00789         out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = y+rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>;
00790         out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = z+rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>;
00791         out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = w+rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>;
00792         <span class="keywordflow">return</span> out;
00793     }
00794 
00795 <span class="comment">/*!***************************************************************************</span>
00796 <span class="comment"> @Function          -</span>
<a name="l00797"></a><a class="code" href="structPVRTVec4.html#a2">00797</a> <span class="comment"> @Input             rhs another PVRTVec4</span>
00798 <span class="comment"> @Returns           result of subtraction</span>
00799 <span class="comment"> @Description       Subtraction operator for PVRTVec4</span>
00800 <span class="comment">****************************************************************************/</span>
00801     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a7">operator-</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)<span class="keyword"> const</span>
00802 <span class="keyword">    </span>{
00803         <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
00804         out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = x-rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>;
00805         out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = y-rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>;
00806         out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = z-rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>;
00807         out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = w-rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>;
00808         <span class="keywordflow">return</span> out;
<a name="l00809"></a><a class="code" href="structPVRTVec4.html#a3">00809</a>     }
00810 
00811 <span class="comment">/*!***************************************************************************</span>
00812 <span class="comment"> @Function          +=</span>
00813 <span class="comment"> @Input             rhs another PVRTVec4</span>
00814 <span class="comment"> @Returns           result of addition and assignment</span>
00815 <span class="comment"> @Description       Addition and assignment operator for PVRTVec4</span>
00816 <span class="comment">****************************************************************************/</span>
00817     <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; <a class="code" href="structPVRTVec4.html#a8">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)
00818     {
00819         x +=rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>;
00820         y +=rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>;
<a name="l00821"></a><a class="code" href="structPVRTVec4.html#a4">00821</a>         z +=rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>;
00822         w +=rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>;
00823         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00824     }
00825 
00826 <span class="comment">/*!***************************************************************************</span>
00827 <span class="comment"> @Function          -=</span>
00828 <span class="comment"> @Input             rhs another PVRTVec4</span>
00829 <span class="comment"> @Returns           result of subtraction and assignment</span>
00830 <span class="comment"> @Description       Subtraction and assignment operator for PVRTVec4</span>
00831 <span class="comment">****************************************************************************/</span>
<a name="l00832"></a><a class="code" href="structPVRTVec4.html#a5">00832</a>     <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; <a class="code" href="structPVRTVec4.html#a9">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)
00833     {
00834         x -=rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>;
00835         y -=rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>;
00836         z -=rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>;
00837         w -=rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>;
00838         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00839     }
00840 
00841 <span class="comment">/*!***************************************************************************</span>
00842 <span class="comment"> @Function          *</span>
00843 <span class="comment"> @Input             rhs a PVRTMat4</span>
00844 <span class="comment"> @Returns           result of multiplication</span>
00845 <span class="comment"> @Description       matrix multiplication for PVRTVec4 and PVRTMat4</span>
00846 <span class="comment">****************************************************************************/</span>
<a name="l00847"></a><a class="code" href="structPVRTVec4.html#a6">00847</a>     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a10">operator*</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs) <span class="keyword">const</span>;
00848 
00849 <span class="comment">/*!***************************************************************************</span>
00850 <span class="comment"> @Function          *=</span>
00851 <span class="comment"> @Input             rhs a PVRTMat4</span>
00852 <span class="comment"> @Returns           result of multiplication and assignement</span>
00853 <span class="comment"> @Description       matrix multiplication and assignment for PVRTVec4 and PVRTMat4</span>
00854 <span class="comment">****************************************************************************/</span>
00855     <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; <a class="code" href="structPVRTVec4.html#a11">operator*=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs);
00856 
00857 <span class="comment">/*!***************************************************************************</span>
00858 <span class="comment"> @Function          *</span>
00859 <span class="comment"> @Input             rhs a single dimension value</span>
00860 <span class="comment"> @Returns           result of multiplication</span>
00861 <span class="comment"> @Description       componentwise multiplication of a PVRTVec4 by a single value</span>
00862 <span class="comment">****************************************************************************/</span>
00863     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a10">operator*</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)<span class="keyword"> const</span>
<a name="l00864"></a><a class="code" href="structPVRTVec4.html#a7">00864</a> <span class="keyword">    </span>{
00865         <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
00866         out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs);
00867         out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs);
00868         out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs);
00869         out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(w,rhs);
00870         <span class="keywordflow">return</span> out;
00871     }
00872 
00873 <span class="comment">/*!***************************************************************************</span>
00874 <span class="comment"> @Function          *=</span>
00875 <span class="comment"> @Input             rhs a single dimension value</span>
00876 <span class="comment"> @Returns           result of multiplication and assignment</span>
00877 <span class="comment"> @Description       componentwise multiplication and assignment of a PVRTVec4 by</span>
00878 <span class="comment">                a single value</span>
00879 <span class="comment">****************************************************************************/</span>
00880     <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; <a class="code" href="structPVRTVec4.html#a11">operator*=</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)
<a name="l00881"></a><a class="code" href="structPVRTVec4.html#a8">00881</a>     {
00882         x = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs);
00883         y = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs);
00884         z = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs);
00885         w = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(w,rhs);
00886         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00887     }
00888 
00889 <span class="comment">/*!***************************************************************************</span>
00890 <span class="comment"> @Function          /</span>
00891 <span class="comment"> @Input             rhs a single dimension value</span>
00892 <span class="comment"> @Returns           result of division</span>
00893 <span class="comment"> @Description       componentwise division of a PVRTVec4 by a single value</span>
00894 <span class="comment">****************************************************************************/</span>
00895     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a14">operator/</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)<span class="keyword"> const</span>
00896 <span class="keyword">    </span>{
<a name="l00897"></a><a class="code" href="structPVRTVec4.html#a9">00897</a>         <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
00898         out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,rhs);
00899         out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,rhs);
00900         out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,rhs);
00901         out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(w,rhs);
00902         <span class="keywordflow">return</span> out;
00903     }
00904 
00905 <span class="comment">/*!***************************************************************************</span>
00906 <span class="comment"> @Function          /=</span>
00907 <span class="comment"> @Input             rhs a single dimension value</span>
00908 <span class="comment"> @Returns           result of division and assignment</span>
00909 <span class="comment"> @Description       componentwise division and assignment of a PVRTVec4 by</span>
00910 <span class="comment">                    a single value</span>
00911 <span class="comment">****************************************************************************/</span>
00912     <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; <a class="code" href="structPVRTVec4.html#a15">operator/=</a>(<span class="keyword">const</span> VERTTYPE&amp; rhs)
00913     {
00914         x = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,rhs);
00915         y = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,rhs);
00916         z = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,rhs);
00917         w = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(w,rhs);
00918         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00919     }
00920 
00921 <span class="comment">/*!***************************************************************************</span>
00922 <span class="comment"> @Function          *</span>
00923 <span class="comment"> @Input             lhs a single dimension value</span>
00924 <span class="comment"> @Input             rhs a PVRTVec4</span>
00925 <span class="comment"> @Returns           result of muliplication</span>
00926 <span class="comment"> @Description       componentwise multiplication of a PVRTVec4 by</span>
00927 <span class="comment">                    a single value</span>
00928 <span class="comment">****************************************************************************/</span>
00929 <span class="keyword">friend</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a10">operator*</a>(<span class="keyword">const</span> VERTTYPE lhs, <span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp;  rhs)
00930 {
<a name="l00931"></a><a class="code" href="structPVRTVec4.html#a12">00931</a>     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
00932     out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>);
00933     out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>);
00934     out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>);
00935     out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(lhs,rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>);
00936     <span class="keywordflow">return</span> out;
00937 }
00938 
00939 <span class="comment">/*!***************************************************************************</span>
00940 <span class="comment"> @Function          ==</span>
00941 <span class="comment"> @Input             rhs a single value</span>
00942 <span class="comment"> @Returns           true if the two vectors are equal</span>
00943 <span class="comment"> @Description       PVRTVec4 equality operator</span>
00944 <span class="comment">****************************************************************************/</span>
00945 <span class="keywordtype">bool</span> <a class="code" href="structPVRTVec4.html#a16">operator==</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)<span class="keyword"> const</span>
00946 <span class="keyword"></span>{
00947     <span class="keywordflow">return</span> ((x == rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>) &amp;&amp; (y == rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>) &amp;&amp; (z == rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>) &amp;&amp; (w == rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>));
00948 }
<a name="l00949"></a><a class="code" href="structPVRTVec4.html#a13">00949</a> 
00950 <span class="comment">/*!***************************************************************************</span>
00951 <span class="comment">@Function           !=</span>
00952 <span class="comment">@Input              rhs a single value</span>
00953 <span class="comment">@Returns            true if the two vectors are not equal</span>
00954 <span class="comment">@Description        PVRTVec4 inequality operator</span>
00955 <span class="comment">    ****************************************************************************/</span>
00956 <span class="keywordtype">bool</span> <a class="code" href="structPVRTVec4.html#a17">operator!=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)<span class="keyword"> const</span>
00957 <span class="keyword"></span>{
00958     <span class="keywordflow">return</span> ((x != rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>) || (y != rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>) || (z != rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>) || (w != rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>));
00959 }
00960 <span class="comment">/*!***************************************************************************</span>
00961 <span class="comment">** Functions</span>
00962 <span class="comment">****************************************************************************/</span>
00963 <span class="comment">/*!***************************************************************************</span>
00964 <span class="comment"> @Function          lenSqr</span>
<a name="l00965"></a><a class="code" href="structPVRTVec4.html#a14">00965</a> <span class="comment"> @Returns           square of the magnitude of the vector</span>
00966 <span class="comment"> @Description       calculates the square of the magnitude of the vector</span>
00967 <span class="comment">****************************************************************************/</span>
00968     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec4.html#a18">lenSqr</a>()<span class="keyword"> const</span>
00969 <span class="keyword">    </span>{
00970         <span class="keywordflow">return</span> <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,x)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,y)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,z)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(w,w);
00971     }
00972 
00973 <span class="comment">/*!***************************************************************************</span>
00974 <span class="comment"> @Function          length</span>
00975 <span class="comment"> @Returns           the magnitude of the vector</span>
00976 <span class="comment"> @Description       calculates the magnitude of the vector</span>
00977 <span class="comment">****************************************************************************/</span>
00978     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec4.html#a19">length</a>()<span class="keyword"> const</span>
00979 <span class="keyword">    </span>{
00980         <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>) <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(sqrt(<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(x)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(x) + <a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(y)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(y) + <a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(z)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(z) + <a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(w)*<a class="code" href="PVRTFixedPoint_8h.html#a26">vt2f</a>(w)));
00981     }
00982 
<a name="l00983"></a><a class="code" href="structPVRTVec4.html#a15">00983</a> <span class="comment">/*!***************************************************************************</span>
00984 <span class="comment"> @Function          normalize</span>
00985 <span class="comment"> @Returns           normalized vector</span>
00986 <span class="comment"> @Description       calculates the normalized value of a PVRTVec4</span>
00987 <span class="comment">****************************************************************************/</span>
00988     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a20">normalize</a>()
00989     {
00990         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> len = <a class="code" href="structPVRTVec4.html#a19">length</a>();
00991         x =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,len);
00992         y =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,len);
00993         z =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,len);
00994         w =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(w,len);
00995         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
00996     }
00997 <span class="comment">/*!***************************************************************************</span>
00998 <span class="comment"> @Function          normalized</span>
00999 <span class="comment"> @Returns           normalized vector</span>
01000 <span class="comment"> @Description       returns a normalized vector of the same direction as this</span>
<a name="l01001"></a><a class="code" href="structPVRTVec4.html#n0">01001</a> <span class="comment">                    vector</span>
01002 <span class="comment">****************************************************************************/</span>
01003     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTVec4.html#a21">normalized</a>()<span class="keyword"> const</span>
01004 <span class="keyword">    </span>{
01005         <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
01006         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> len = <a class="code" href="structPVRTVec4.html#a19">length</a>();
01007         out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(x,len);
01008         out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(y,len);
01009         out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(z,len);
01010         out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> =<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(w,len);
01011         <span class="keywordflow">return</span> out;
01012     }
01013 
01014 <span class="comment">/*!***************************************************************************</span>
01015 <span class="comment"> @Function          dot</span>
01016 <span class="comment"> @Returns           scalar product</span>
01017 <span class="comment"> @Description       returns a normalized vector of the same direction as this</span>
<a name="l01018"></a><a class="code" href="structPVRTVec4.html#a16">01018</a> <span class="comment">                    vector</span>
01019 <span class="comment">****************************************************************************/</span>
01020     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTVec4.html#a22">dot</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)<span class="keyword"> const</span>
01021 <span class="keyword">    </span>{
01022         <span class="keywordflow">return</span> <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(x,rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(y,rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(z,rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>)+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(w,rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>);
01023     }
01024 
01025 <span class="comment">/*!***************************************************************************</span>
01026 <span class="comment"> @Function          ptr</span>
01027 <span class="comment"> @Returns           pointer to vector values</span>
01028 <span class="comment"> @Description       returns a pointer to memory containing the values of the</span>
01029 <span class="comment">                    PVRTVec3</span>
<a name="l01030"></a><a class="code" href="structPVRTVec4.html#a17">01030</a> <span class="comment">****************************************************************************/</span>
01031     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *<a class="code" href="structPVRTVec4.html#a23">ptr</a>() { <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>*)<span class="keyword">this</span>; }
01032 };
01033 
01034 <span class="comment">/*!***************************************************************************</span>
01035 <span class="comment">** PVRTMat3 3x3 Matrix</span>
01036 <span class="comment">****************************************************************************/</span>
01037 <span class="keyword">struct </span><a class="code" href="structPVRTMat3.html">PVRTMat3</a> : <span class="keyword">public</span> <a class="code" href="classPVRTMATRIX3f.html">PVRTMATRIX3</a>
01038 {
01039 <span class="comment">/*!***************************************************************************</span>
01040 <span class="comment">** Constructors</span>
01041 <span class="comment">****************************************************************************/</span>
01042 <span class="comment">/*!***************************************************************************</span>
<a name="l01043"></a><a class="code" href="structPVRTVec4.html#a18">01043</a> <span class="comment"> @Function          PVRTMat3</span>
01044 <span class="comment"> @Description       Blank constructor.</span>
01045 <span class="comment">*****************************************************************************/</span>
01046     <a class="code" href="structPVRTMat3.html#a0">PVRTMat3</a>(){}
01047 <span class="comment">/*!***************************************************************************</span>
01048 <span class="comment"> @Function          PVRTMat3</span>
01049 <span class="comment"> @Input             pMat an array of values for the matrix</span>
01050 <span class="comment"> @Description       Constructor from array.</span>
01051 <span class="comment">*****************************************************************************/</span>
01052     <a class="code" href="structPVRTMat3.html#a0">PVRTMat3</a>(<span class="keyword">const</span> VERTTYPE* pMat)
01053     {
<a name="l01054"></a><a class="code" href="structPVRTVec4.html#a19">01054</a>         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>* ptr = f;
01055         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;9;i++)
01056         {
01057             (*ptr++)=(*pMat++);
01058         }
01059     }
01060 
01061 <span class="comment">/*!***************************************************************************</span>
01062 <span class="comment"> @Function          PVRTMat3</span>
01063 <span class="comment"> @Input             m0 matrix value</span>
01064 <span class="comment"> @Input             m1 matrix value</span>
<a name="l01065"></a><a class="code" href="structPVRTVec4.html#a20">01065</a> <span class="comment"> @Input             m2 matrix value</span>
01066 <span class="comment"> @Input             m3 matrix value</span>
01067 <span class="comment"> @Input             m4 matrix value</span>
01068 <span class="comment"> @Input             m5 matrix value</span>
01069 <span class="comment"> @Input             m6 matrix value</span>
01070 <span class="comment"> @Input             m7 matrix value</span>
01071 <span class="comment"> @Input             m8 matrix value</span>
01072 <span class="comment"> @Description       Constructor from distinct values.</span>
01073 <span class="comment">*****************************************************************************/</span>
01074     <a class="code" href="structPVRTMat3.html#a0">PVRTMat3</a>(VERTTYPE m0,VERTTYPE m1,VERTTYPE m2,
01075         VERTTYPE m3,VERTTYPE m4,VERTTYPE m5,
01076         VERTTYPE m6,VERTTYPE m7,VERTTYPE m8)
01077     {
01078         f[0]=m0;f[1]=m1;f[2]=m2;
01079         f[3]=m3;f[4]=m4;f[5]=m5;
01080         f[6]=m6;f[7]=m7;f[8]=m8;
<a name="l01081"></a><a class="code" href="structPVRTVec4.html#a21">01081</a>     }
01082 
01083 <span class="comment">/*!***************************************************************************</span>
01084 <span class="comment"> @Function          PVRTMat3</span>
01085 <span class="comment"> @Input             mat - a PVRTMat4</span>
01086 <span class="comment"> @Description       Constructor from 4x4 matrix - uses top left values</span>
01087 <span class="comment">*****************************************************************************/</span>
01088     <a class="code" href="structPVRTMat3.html#a0">PVRTMat3</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; mat);
01089 
01090 <span class="comment">/****************************************************************************</span>
01091 <span class="comment">** PVRTMat3 OPERATORS</span>
01092 <span class="comment">****************************************************************************/</span>
01093 <span class="comment">/*!***************************************************************************</span>
01094 <span class="comment"> @Function          ()</span>
01095 <span class="comment"> @Input             row         row of matrix</span>
01096 <span class="comment"> @Input             column      column of matrix</span>
01097 <span class="comment"> @Returns           value of element</span>
01098 <span class="comment"> @Description       Returns the value of the element at the specified row and column</span>
<a name="l01099"></a><a class="code" href="structPVRTVec4.html#a22">01099</a> <span class="comment">                    of the PVRTMat3</span>
01100 <span class="comment">*****************************************************************************/</span>
01101     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>&amp; <a class="code" href="structPVRTMat3.html#a4">operator()</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> row, <span class="keyword">const</span> <span class="keywordtype">int</span> column)
01102     {
01103         <span class="keywordflow">return</span> f[column*3+row];
01104     }
01105 <span class="comment">/*!***************************************************************************</span>
01106 <span class="comment"> @Function          ()</span>
01107 <span class="comment"> @Input             row         row of matrix</span>
01108 <span class="comment"> @Input             column      column of matrix</span>
01109 <span class="comment"> @Returns           value of element</span>
01110 <span class="comment"> @Description       Returns the value of the element at the specified row and column</span>
<a name="l01111"></a><a class="code" href="structPVRTVec4.html#a23">01111</a> <span class="comment">                    of the PVRTMat3</span>
01112 <span class="comment">*****************************************************************************/</span>
01113     <span class="keyword">const</span> <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>&amp; <a class="code" href="structPVRTMat3.html#a4">operator()</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> row, <span class="keyword">const</span> <span class="keywordtype">int</span> column)<span class="keyword"> const</span>
01114 <span class="keyword">    </span>{
01115         <span class="keywordflow">return</span> f[column*3+row];
01116     }
<a name="l01117"></a><a class="code" href="structPVRTMat3.html">01117</a> 
01118 <span class="comment">/*!***************************************************************************</span>
01119 <span class="comment"> @Function          *</span>
01120 <span class="comment"> @Input             rhs another PVRTMat3</span>
01121 <span class="comment"> @Returns           result of multiplication</span>
01122 <span class="comment"> @Description       Matrix multiplication of two 3x3 matrices.</span>
01123 <span class="comment">*****************************************************************************/</span>
01124     <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#a6">operator*</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs)<span class="keyword"> const</span>
01125 <span class="keyword">    </span>{
01126         <a class="code" href="structPVRTMat3.html">PVRTMat3</a> out;
<a name="l01127"></a><a class="code" href="structPVRTMat3.html#a0">01127</a>         <span class="comment">// col 1</span>
01128         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2]);
01129         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2]);
01130         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2]);
01131 
01132         <span class="comment">// col 2</span>
01133         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5]);
<a name="l01134"></a><a class="code" href="structPVRTMat3.html#a1">01134</a>         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5]);
01135         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5]);
01136 
01137         <span class="comment">// col3</span>
01138         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8]);
01139         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8]);
01140         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8]);
01141         <span class="keywordflow">return</span> out;
01142     }
01143 
01144 <span class="comment">/*!***************************************************************************</span>
01145 <span class="comment"> @Function          +</span>
01146 <span class="comment"> @Input             rhs another PVRTMat3</span>
01147 <span class="comment"> @Returns           result of addition</span>
01148 <span class="comment"> @Description       element by element addition operator.</span>
01149 <span class="comment">*****************************************************************************/</span>
01150     <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#a7">operator+</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs)<span class="keyword"> const</span>
01151 <span class="keyword">    </span>{
01152         <a class="code" href="structPVRTMat3.html">PVRTMat3</a> out;
01153         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <span class="keyword">const</span> *lptr = f, *rptr = rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>;
01154         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *outptr = out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>;
01155         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;9;i++)
01156         {
<a name="l01157"></a><a class="code" href="structPVRTMat3.html#a2">01157</a>             (*outptr++) = (*lptr++) + (*rptr++);
01158         }
01159         <span class="keywordflow">return</span> out;
01160     }
01161 
01162 <span class="comment">/*!***************************************************************************</span>
01163 <span class="comment"> @Function          -</span>
01164 <span class="comment"> @Input             rhs another PVRTMat3</span>
01165 <span class="comment"> @Returns           result of subtraction</span>
01166 <span class="comment"> @Description       element by element subtraction operator.</span>
01167 <span class="comment">*****************************************************************************/</span>
01168     <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#a8">operator-</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs)<span class="keyword"> const</span>
01169 <span class="keyword">    </span>{
01170         <a class="code" href="structPVRTMat3.html">PVRTMat3</a> out;
01171         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <span class="keyword">const</span> *lptr = f, *rptr = rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>;
01172         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *outptr = out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>;
01173         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;9;i++)
01174         {
01175             (*outptr++) = (*lptr++) - (*rptr++);
01176         }
01177         <span class="keywordflow">return</span> out;
01178     }
01179 
01180 <span class="comment">/*!***************************************************************************</span>
01181 <span class="comment"> @Function          +=</span>
01182 <span class="comment"> @Input             rhs another PVRTMat3</span>
01183 <span class="comment"> @Returns           result of addition and assignment</span>
01184 <span class="comment"> @Description       element by element addition and assignment operator.</span>
01185 <span class="comment">*****************************************************************************/</span>
<a name="l01186"></a><a class="code" href="structPVRTMat3.html#a4">01186</a>     <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; <a class="code" href="structPVRTMat3.html#a9">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs)
01187     {
01188         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *lptr = f;
01189         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <span class="keyword">const</span> *rptr = rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>;
01190         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;9;i++)
01191         {
01192             (*lptr++) += (*rptr++);
01193         }
01194         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01195     }
01196 
01197 <span class="comment">/*!***************************************************************************</span>
01198 <span class="comment"> @Function          -=</span>
<a name="l01199"></a><a class="code" href="structPVRTMat3.html#a5">01199</a> <span class="comment"> @Input             rhs another PVRTMat3</span>
01200 <span class="comment"> @Returns           result of subtraction and assignment</span>
01201 <span class="comment"> @Description       element by element subtraction and assignment operator.</span>
01202 <span class="comment">*****************************************************************************/</span>
01203     <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; <a class="code" href="structPVRTMat3.html#a10">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs)
01204     {
01205         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *lptr = f;
01206         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <span class="keyword">const</span> *rptr = rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>;
01207         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;9;i++)
01208         {
01209             (*lptr++) -= (*rptr++);
01210         }
<a name="l01211"></a><a class="code" href="structPVRTMat3.html#a6">01211</a>         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01212     }
01213 
01214 <span class="comment">/*!***************************************************************************</span>
01215 <span class="comment"> @Function          *=</span>
01216 <span class="comment"> @Input             rhs another PVRTMat3</span>
01217 <span class="comment"> @Returns           result of multiplication and assignment</span>
01218 <span class="comment"> @Description       Matrix multiplication and assignment of two 3x3 matrices.</span>
01219 <span class="comment">*****************************************************************************/</span>
01220     <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; <a class="code" href="structPVRTMat3.html#a11">operator*=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; rhs)
01221     {
01222         <a class="code" href="structPVRTMat3.html">PVRTMat3</a> out;
01223         <span class="comment">// col 1</span>
01224         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2]);
01225         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2]);
01226         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2]);
01227 
01228         <span class="comment">// col 2</span>
01229         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5]);
01230         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5]);
01231         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5]);
01232 
01233         <span class="comment">// col3</span>
01234         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8]);
01235         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8]);
01236         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8]);
01237         *<span class="keyword">this</span> = out;
<a name="l01238"></a><a class="code" href="structPVRTMat3.html#a7">01238</a>         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01239     }
01240 
01241 <span class="comment">/*!***************************************************************************</span>
01242 <span class="comment"> @Function          *</span>
01243 <span class="comment"> @Input             rhs a single value</span>
01244 <span class="comment"> @Returns           result of multiplication and assignment</span>
01245 <span class="comment"> @Description       element multiplication by a single value.</span>
01246 <span class="comment">*****************************************************************************/</span>
01247     <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; <a class="code" href="structPVRTMat3.html#a6">operator*</a>(<span class="keyword">const</span> VERTTYPE rhs)
01248     {
01249         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;9; ++i)
01250         {
01251             f[i]*=rhs;
01252         }
01253         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01254     }
01255 <span class="comment">/*!***************************************************************************</span>
01256 <span class="comment"> @Function          *=</span>
<a name="l01257"></a><a class="code" href="structPVRTMat3.html#a8">01257</a> <span class="comment"> @Input             rhs a single value</span>
01258 <span class="comment"> @Returns           result of multiplication and assignment</span>
01259 <span class="comment"> @Description       element multiplication and assignment by a single value.</span>
01260 <span class="comment">*****************************************************************************/</span>
01261     <a class="code" href="structPVRTMat3.html">PVRTMat3</a>&amp; <a class="code" href="structPVRTMat3.html#a11">operator*=</a>(<span class="keyword">const</span> VERTTYPE rhs)
01262     {
01263         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;9; ++i)
01264         {
01265             f[i]*=rhs;
01266         }
01267         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01268     }
01269 
01270 <span class="comment">/*!***************************************************************************</span>
01271 <span class="comment"> @Function          *</span>
01272 <span class="comment"> @Input             rhs another PVRTVec3</span>
01273 <span class="comment"> @Returns           result of multiplication</span>
01274 <span class="comment"> @Description       Matrix multiplication of 3x3 matrix and vec3</span>
01275 <span class="comment">*****************************************************************************/</span>
<a name="l01276"></a><a class="code" href="structPVRTMat3.html#a9">01276</a>     <a class="code" href="structPVRTVec3.html">PVRTVec3</a> <a class="code" href="structPVRTMat3.html#a6">operator*</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; rhs)<span class="keyword"> const</span>
01277 <span class="keyword">    </span>{
01278         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> out;
01279         out.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>,f[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>,f[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>,f[6]);
01280         out.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>,f[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>,f[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>,f[7]);
01281         out.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>,f[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>,f[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>,f[8]);
01282 
01283         <span class="keywordflow">return</span> out;
01284     }
01285 
01286 
01287     <span class="comment">// FUNCTIONS</span>
01288 <span class="comment">/*!***************************************************************************</span>
01289 <span class="comment">** Functions</span>
01290 <span class="comment">*****************************************************************************/</span>
01291 <span class="comment">/*!***************************************************************************</span>
01292 <span class="comment"> @Function          determinant</span>
01293 <span class="comment"> @Returns           result of multiplication</span>
<a name="l01294"></a><a class="code" href="structPVRTMat3.html#a10">01294</a> <span class="comment"> @Description       Matrix multiplication and assignment of 3x3 matrix and vec3</span>
01295 <span class="comment">*****************************************************************************/</span>
01296     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <a class="code" href="structPVRTMat3.html#a15">determinant</a>()<span class="keyword"> const</span>
01297 <span class="keyword">    </span>{
01298         <span class="keywordflow">return</span> <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],f[8])-<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],f[5])))
01299             - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],f[8])-<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],f[2])))
01300             + <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],f[5])-<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],f[2])));
01301     }
01302 
01303 <span class="comment">/*!***************************************************************************</span>
01304 <span class="comment"> @Function          inverse</span>
01305 <span class="comment"> @Returns           inverse mat3</span>
01306 <span class="comment"> @Description       Calculates multiplicative inverse of this matrix</span>
01307 <span class="comment">*****************************************************************************/</span>
01308     <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#a16">inverse</a>()<span class="keyword"> const</span>
01309 <span class="keyword">    </span>{
01310         <a class="code" href="structPVRTMat3.html">PVRTMat3</a> out;
01311 
<a name="l01312"></a><a class="code" href="structPVRTMat3.html#a11">01312</a> 
01313         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> recDet = <a class="code" href="structPVRTMat3.html#a15">determinant</a>();
01314         <a class="code" href="PVRTGlobal_8h.html#a10">_ASSERT</a>(recDet!=0);
01315         recDet = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1.0f),recDet);
01316 
01317         <span class="comment">//TODO: deal with singular matrices with more than just an assert</span>
01318 
01319         <span class="comment">// inverse is 1/det * adjoint of M</span>
01320 
01321         <span class="comment">// adjoint is transpose of cofactor matrix</span>
01322 
01323         <span class="comment">// do transpose and cofactors in one step</span>
01324 
01325         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],f[8]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],f[7]);
01326         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],f[7]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],f[8]);
01327         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],f[5]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],f[4]);
01328 
01329         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],f[6]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],f[8]);
01330         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],f[8]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],f[6]);
01331         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],f[3]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],f[5]);
01332 
01333         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],f[7]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],f[6]);
01334         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],f[6]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],f[7]);
01335         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],f[4]) - <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],f[3]);
01336 
01337         out *= recDet;
01338         <span class="keywordflow">return</span> out;
01339     }
<a name="l01340"></a><a class="code" href="structPVRTMat3.html#a12">01340</a> 
01341 <span class="comment">/*!***************************************************************************</span>
01342 <span class="comment"> @Function          transpose</span>
01343 <span class="comment"> @Returns           transpose 3x3 matrix</span>
01344 <span class="comment"> @Description       Calculates the transpose of this matrix</span>
01345 <span class="comment">*****************************************************************************/</span>
01346     <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#a17">transpose</a>()<span class="keyword"> const</span>
01347 <span class="keyword">    </span>{
01348         <a class="code" href="structPVRTMat3.html">PVRTMat3</a> out;
01349         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0] = f[0];    out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3] = f[1];    out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6] = f[2];
01350         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1] = f[3];    out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4] = f[4];    out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7] = f[5];
01351         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2] = f[6];    out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5] = f[7];    out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8] = f[8];
01352         <span class="keywordflow">return</span> out;
01353     }
01354 
<a name="l01355"></a><a class="code" href="structPVRTMat3.html#a13">01355</a> <span class="comment">/*!***************************************************************************</span>
01356 <span class="comment"> @Function          ptr</span>
01357 <span class="comment"> @Returns           pointer to an array of the elements of this PVRTMat3</span>
01358 <span class="comment"> @Description       Calculates transpose of this matrix</span>
01359 <span class="comment">*****************************************************************************/</span>
01360     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *<a class="code" href="structPVRTMat3.html#a18">ptr</a>() { <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>*)&amp;f; }
01361 
01362 <span class="comment">/*!***************************************************************************</span>
01363 <span class="comment">** Static factory functions</span>
01364 <span class="comment">*****************************************************************************/</span>
01365 <span class="comment">/*!***************************************************************************</span>
01366 <span class="comment"> @Function          Identity</span>
01367 <span class="comment"> @Returns           a PVRTMat3 representation of the 3x3 identity matrix</span>
01368 <span class="comment"> @Description       Generates an identity matrix</span>
01369 <span class="comment">*****************************************************************************/</span>
01370     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e0">Identity</a>()
<a name="l01371"></a><a class="code" href="structPVRTMat3.html#a14">01371</a>     {
01372         <a class="code" href="structPVRTMat3.html">PVRTMat3</a> out;
01373         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[0] = 1;out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[1] = 0;out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[2] = 0;
01374         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[3] = 0;out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[4] = 1;out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[5] = 0;
01375         out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[6] = 0;out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[7] = 0;out.<a class="code" href="classPVRTMATRIX3f.html#o0">f</a>[8] = 1;
01376         <span class="keywordflow">return</span> out;
01377     }
01378 
01379 <span class="comment">/*!***************************************************************************</span>
01380 <span class="comment"> @Function          RotationX</span>
01381 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested rotation</span>
01382 <span class="comment"> @Description       Calculates a matrix corresponding to a rotation of angle</span>
01383 <span class="comment">                    degrees about the X axis</span>
01384 <span class="comment">*****************************************************************************/</span>
01385     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e1">RotationX</a>(VERTTYPE angle);
01386 
01387 <span class="comment">/*!***************************************************************************</span>
01388 <span class="comment"> @Function          RotationY</span>
01389 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested rotation</span>
01390 <span class="comment"> @Description       Calculates a matrix corresponding to a rotation of angle</span>
01391 <span class="comment">                    degrees about the Y axis</span>
<a name="l01392"></a><a class="code" href="structPVRTMat3.html#a15">01392</a> <span class="comment">*****************************************************************************/</span>
01393     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e2">RotationY</a>(VERTTYPE angle);
01394 
01395 <span class="comment">/*!***************************************************************************</span>
01396 <span class="comment"> @Function          RotationZ</span>
01397 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested rotation</span>
01398 <span class="comment"> @Description       Calculates a matrix corresponding to a rotation of angle</span>
01399 <span class="comment">                    degrees about the Z axis</span>
01400 <span class="comment">*****************************************************************************/</span>
01401     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e3">RotationZ</a>(VERTTYPE angle);
01402 
01403 <span class="comment">/*!***************************************************************************</span>
01404 <span class="comment"> @Function          Rotation2D</span>
<a name="l01405"></a><a class="code" href="structPVRTMat3.html#a16">01405</a> <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested rotation</span>
01406 <span class="comment"> @Description       Calculates a matrix corresponding to a rotation of angle</span>
01407 <span class="comment">                    degrees about the Z axis</span>
01408 <span class="comment">*****************************************************************************/</span>
01409     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e4">Rotation2D</a>(VERTTYPE angle)
01410     {
01411         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat3.html#e3">RotationZ</a>(angle);
01412     }
01413 
01414 <span class="comment">/*!***************************************************************************</span>
01415 <span class="comment"> @Function          Scale</span>
01416 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested scaling transformation</span>
01417 <span class="comment"> @Description       Calculates a matrix corresponding to scaling of fx, fy and fz</span>
01418 <span class="comment">                    times in each axis.</span>
01419 <span class="comment">*****************************************************************************/</span>
01420     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e5">Scale</a>(<span class="keyword">const</span> VERTTYPE fx,<span class="keyword">const</span> VERTTYPE fy,<span class="keyword">const</span> VERTTYPE fz)
01421     {
01422         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat3.html#a0">PVRTMat3</a>(fx,0,0,
01423                         0,fy,0,
01424                         0,0,fz);
01425     }
01426 
01427 <span class="comment">/*!***************************************************************************</span>
01428 <span class="comment"> @Function          Scale2D</span>
01429 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested scaling transformation</span>
01430 <span class="comment"> @Description       Calculates a matrix corresponding to scaling of fx, fy and fz</span>
01431 <span class="comment">                    times in each axis.</span>
01432 <span class="comment">*****************************************************************************/</span>
01433     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e6">Scale2D</a>(<span class="keyword">const</span> VERTTYPE fx,<span class="keyword">const</span> VERTTYPE fy)
01434     {
01435         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat3.html#a0">PVRTMat3</a>(fx,0,0,
01436                         0,fy,0,
01437                         0,0,<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1));
01438     }
01439 
01440 <span class="comment">/*!***************************************************************************</span>
01441 <span class="comment"> @Function          Translation2D</span>
01442 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested translation</span>
01443 <span class="comment"> @Description       Calculates a matrix corresponding to a transformation</span>
<a name="l01444"></a><a class="code" href="structPVRTMat3.html#a17">01444</a> <span class="comment">                    of tx and ty times in each axis.</span>
01445 <span class="comment">*****************************************************************************/</span>
01446     <span class="keyword">static</span> <a class="code" href="structPVRTMat3.html">PVRTMat3</a> <a class="code" href="structPVRTMat3.html#e7">Translation2D</a>(<span class="keyword">const</span> VERTTYPE tx, <span class="keyword">const</span> VERTTYPE ty)
01447     {
01448         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat3.html#a0">PVRTMat3</a>( <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1),    0,  0,
01449                          0,    <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1),  0,
01450                         tx,         ty,  <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1));
01451     }
01452 
01453 };
01454 
01455 <span class="comment">/*!***************************************************************************</span>
01456 <span class="comment">** PVRTMat4 4x4 Matrix</span>
01457 <span class="comment">****************************************************************************/</span>
01458 <span class="keyword">struct </span><a class="code" href="structPVRTMat4.html">PVRTMat4</a> : <span class="keyword">public</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a>
<a name="l01459"></a><a class="code" href="structPVRTMat3.html#a18">01459</a> {
01460 <span class="comment">/*!***************************************************************************</span>
01461 <span class="comment">** Constructors</span>
01462 <span class="comment">****************************************************************************/</span>
01463 <span class="comment">/*!***************************************************************************</span>
01464 <span class="comment"> @Function          PVRTMat4</span>
01465 <span class="comment"> @Description       Blank constructor.</span>
01466 <span class="comment">*****************************************************************************/</span>
01467     <a class="code" href="structPVRTMat4.html#a0">PVRTMat4</a>(){}
01468 <span class="comment">/*!***************************************************************************</span>
01469 <span class="comment"> @Function          PVRTMat4</span>
<a name="l01470"></a><a class="code" href="structPVRTMat3.html#e0">01470</a> <span class="comment"> @Input             m0 matrix value</span>
01471 <span class="comment"> @Input             m1 matrix value</span>
01472 <span class="comment"> @Input             m2 matrix value</span>
01473 <span class="comment"> @Input             m3 matrix value</span>
01474 <span class="comment"> @Input             m4 matrix value</span>
01475 <span class="comment"> @Input             m5 matrix value</span>
01476 <span class="comment"> @Input             m6 matrix value</span>
01477 <span class="comment"> @Input             m7 matrix value</span>
01478 <span class="comment"> @Input             m8 matrix value</span>
01479 <span class="comment"> @Input             m9 matrix value</span>
01480 <span class="comment"> @Input             m10 matrix value</span>
01481 <span class="comment"> @Input             m11 matrix value</span>
01482 <span class="comment"> @Input             m12 matrix value</span>
01483 <span class="comment"> @Input             m13 matrix value</span>
01484 <span class="comment"> @Input             m14 matrix value</span>
01485 <span class="comment"> @Input             m15 matrix value</span>
01486 <span class="comment"> @Description       Constructor from array.</span>
01487 <span class="comment">*****************************************************************************/</span>
01488     <a class="code" href="structPVRTMat4.html#a0">PVRTMat4</a>(VERTTYPE m0,VERTTYPE m1,VERTTYPE m2,VERTTYPE m3,
01489         VERTTYPE m4,VERTTYPE m5,VERTTYPE m6,VERTTYPE m7,
01490         VERTTYPE m8,VERTTYPE m9,VERTTYPE m10,VERTTYPE m11,
01491         VERTTYPE m12,VERTTYPE m13,VERTTYPE m14,VERTTYPE m15)
01492     {
01493         f[0]=m0;f[1]=m1;f[2]=m2;f[3]=m3;
01494         f[4]=m4;f[5]=m5;f[6]=m6;f[7]=m7;
01495         f[8]=m8;f[9]=m9;f[10]=m10;f[11]=m11;
01496         f[12]=m12;f[13]=m13;f[14]=m14;f[15]=m15;
01497     }
01498 <span class="comment">/*!***************************************************************************</span>
01499 <span class="comment"> @Function          PVRTMat4</span>
01500 <span class="comment"> @Input             mat A pointer to an array of 16 VERTTYPEs</span>
01501 <span class="comment"> @Description       Constructor from distinct values.</span>
01502 <span class="comment">*****************************************************************************/</span>
01503     <a class="code" href="structPVRTMat4.html#a0">PVRTMat4</a>(<span class="keyword">const</span> VERTTYPE* mat)
01504     {
01505         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>* ptr = f;
01506         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;16;i++)
01507         {
01508             (*ptr++)=(*mat++);
01509         }
01510     }
01511 
01512 <span class="comment">/****************************************************************************</span>
<a name="l01513"></a><a class="code" href="structPVRTMat3.html#e4">01513</a> <span class="comment">** PVRTMat4 OPERATORS</span>
01514 <span class="comment">****************************************************************************/</span>
01515 <span class="comment">/*!***************************************************************************</span>
01516 <span class="comment"> @Function          ()</span>
01517 <span class="comment"> @Input             r - row of matrix</span>
01518 <span class="comment"> @Input             c - column of matrix</span>
01519 <span class="comment"> @Returns           value of element</span>
01520 <span class="comment"> @Description       Returns value of the element at row r and colun c of the</span>
01521 <span class="comment">                    PVRTMat4</span>
01522 <span class="comment">*****************************************************************************/</span>
01523     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>&amp; <a class="code" href="structPVRTMat4.html#a3">operator()</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> r, <span class="keyword">const</span> <span class="keywordtype">int</span> c)
01524     {
<a name="l01525"></a><a class="code" href="structPVRTMat3.html#e5">01525</a>         <span class="keywordflow">return</span> f[c*4+r];
01526     }
01527 
01528 <span class="comment">/*!***************************************************************************</span>
01529 <span class="comment"> @Function          ()</span>
01530 <span class="comment"> @Input             r - row of matrix</span>
01531 <span class="comment"> @Input             c - column of matrix</span>
01532 <span class="comment"> @Returns           value of element</span>
01533 <span class="comment"> @Description       Returns value of the element at row r and colun c of the</span>
01534 <span class="comment">                    PVRTMat4</span>
01535 <span class="comment">*****************************************************************************/</span>
01536     <span class="keyword">const</span> <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>&amp; <a class="code" href="structPVRTMat4.html#a3">operator()</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> r, <span class="keyword">const</span> <span class="keywordtype">int</span> c)<span class="keyword"> const</span>
01537 <span class="keyword">    </span>{
01538         <span class="keywordflow">return</span> f[c*4+r];
<a name="l01539"></a><a class="code" href="structPVRTMat3.html#e6">01539</a>     }
01540 
01541 <span class="comment">/*!***************************************************************************</span>
01542 <span class="comment"> @Function          *</span>
01543 <span class="comment"> @Input             rhs another PVRTMat4</span>
01544 <span class="comment"> @Returns           result of multiplication</span>
01545 <span class="comment"> @Description       Matrix multiplication of two 4x4 matrices.</span>
01546 <span class="comment">*****************************************************************************/</span>
01547     <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#a5">operator*</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs) <span class="keyword">const</span>;
01548 
01549 <span class="comment">/*!***************************************************************************</span>
01550 <span class="comment"> @Function          +</span>
01551 <span class="comment"> @Input             rhs another PVRTMat4</span>
01552 <span class="comment"> @Returns           result of addition</span>
<a name="l01553"></a><a class="code" href="structPVRTMat3.html#e7">01553</a> <span class="comment"> @Description       element by element addition operator.</span>
01554 <span class="comment">*****************************************************************************/</span>
01555     <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#a6">operator+</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs)<span class="keyword"> const</span>
01556 <span class="keyword">    </span>{
01557         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> out;
01558         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <span class="keyword">const</span> *lptr = f, *rptr = rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>;
01559         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *outptr = out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>;
01560         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;16;i++)
01561         {
01562             (*outptr++) = (*lptr++) + (*rptr++);
01563         }
01564         <span class="keywordflow">return</span> out;
<a name="l01565"></a><a class="code" href="structPVRTMat4.html">01565</a>     }
01566 
01567 <span class="comment">/*!***************************************************************************</span>
01568 <span class="comment"> @Function          -</span>
01569 <span class="comment"> @Input             rhs another PVRTMat4</span>
01570 <span class="comment"> @Returns           result of subtraction</span>
01571 <span class="comment"> @Description       element by element subtraction operator.</span>
01572 <span class="comment">*****************************************************************************/</span>
01573     <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#a7">operator-</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs)<span class="keyword"> const</span>
01574 <span class="keyword">    </span>{
<a name="l01575"></a><a class="code" href="structPVRTMat4.html#a0">01575</a>         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> out;
01576         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;16;i++)
01577         {
01578             out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[i] = f[i]-rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[i];
01579         }
01580         <span class="keywordflow">return</span> out;
01581     }
01582 
01583 <span class="comment">/*!***************************************************************************</span>
01584 <span class="comment"> @Function          +=</span>
01585 <span class="comment"> @Input             rhs another PVRTMat4</span>
01586 <span class="comment"> @Returns           result of addition and assignment</span>
01587 <span class="comment"> @Description       element by element addition and assignment operator.</span>
01588 <span class="comment">*****************************************************************************/</span>
01589     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a8">operator+=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs)
01590     {
01591         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *lptr = f;
01592         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <span class="keyword">const</span> *rptr = rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>;
01593         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;16;i++)
01594         {
01595             (*lptr++) += (*rptr++);
01596         }
<a name="l01597"></a><a class="code" href="structPVRTMat4.html#a1">01597</a>         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01598     }
01599 
01600 <span class="comment">/*!***************************************************************************</span>
01601 <span class="comment"> @Function          -=</span>
01602 <span class="comment"> @Input             rhs another PVRTMat4</span>
01603 <span class="comment"> @Returns           result of subtraction and assignment</span>
01604 <span class="comment"> @Description       element by element subtraction and assignment operator.</span>
01605 <span class="comment">*****************************************************************************/</span>
01606     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a9">operator-=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs)
01607     {
01608         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *lptr = f;
01609         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> <span class="keyword">const</span> *rptr = rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>;
01610         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;16;i++)
01611         {
01612             (*lptr++) -= (*rptr++);
<a name="l01613"></a><a class="code" href="structPVRTMat4.html#a2">01613</a>         }
01614         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01615     }
01616 
01617 
01618 <span class="comment">/*!***************************************************************************</span>
01619 <span class="comment"> @Function          *=</span>
01620 <span class="comment"> @Input             rhs another PVRTMat4</span>
01621 <span class="comment"> @Returns           result of multiplication and assignment</span>
01622 <span class="comment"> @Description       Matrix multiplication and assignment of two 4x4 matrices.</span>
01623 <span class="comment">*****************************************************************************/</span>
01624     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a10">operator*=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs)
01625     {
01626         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> result;
01627         <span class="comment">// col 0</span>
01628         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[12],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3]);
01629         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[9],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[13],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3]);
01630         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[10],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[14],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3]);
01631         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[11],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[15],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3]);
01632 
01633         <span class="comment">// col 1</span>
<a name="l01634"></a><a class="code" href="structPVRTMat4.html#a3">01634</a>         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[12],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]);
01635         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[9],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[13],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]);
01636         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[10],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[14],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]);
01637         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[11],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[15],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]);
01638 
01639         <span class="comment">// col 2</span>
01640         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[12],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]);
01641         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9] =   <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[9],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[13],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]);
01642         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[10],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[14],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]);
01643         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[11],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[15],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]);
01644 
01645         <span class="comment">// col 3</span>
01646         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[0],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[4],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[8],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[12],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]);
01647         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[1],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[5],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[9],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[13],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]);
<a name="l01648"></a><a class="code" href="structPVRTMat4.html#a4">01648</a>         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[2],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[6],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[10],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[14],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]);
01649         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15] =  <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[11],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[15],rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]);
01650 
01651         *<span class="keyword">this</span> = result;
01652         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01653     }
01654 
01655 <span class="comment">/*!***************************************************************************</span>
01656 <span class="comment"> @Function          *</span>
01657 <span class="comment"> @Input             rhs a single value</span>
01658 <span class="comment"> @Returns           result of multiplication and assignment</span>
01659 <span class="comment"> @Description       element multiplication by a single value.</span>
01660 <span class="comment">*****************************************************************************/</span>
01661     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a5">operator*</a>(<span class="keyword">const</span> VERTTYPE rhs)
01662     {
01663         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;16; ++i)
01664         {
01665             f[i]*=rhs;
01666         }
01667         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01668     }
<a name="l01669"></a><a class="code" href="structPVRTMat4.html#a6">01669</a> <span class="comment">/*!***************************************************************************</span>
01670 <span class="comment"> @Function          *=</span>
01671 <span class="comment"> @Input             rhs a single value</span>
01672 <span class="comment"> @Returns           result of multiplication and assignment</span>
01673 <span class="comment"> @Description       element multiplication and assignment by a single value.</span>
01674 <span class="comment">*****************************************************************************/</span>
01675     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a10">operator*=</a>(<span class="keyword">const</span> VERTTYPE rhs)
01676     {
01677         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;16; ++i)
01678         {
01679             f[i]*=rhs;
01680         }
01681         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01682     }
01683 
01684 <span class="comment">/*!***************************************************************************</span>
01685 <span class="comment"> @Function          =</span>
01686 <span class="comment"> @Input             rhs another PVRTMat4</span>
01687 <span class="comment"> @Returns           result of assignment</span>
<a name="l01688"></a><a class="code" href="structPVRTMat4.html#a7">01688</a> <span class="comment"> @Description       element assignment operator.</span>
01689 <span class="comment">*****************************************************************************/</span>
01690     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a13">operator=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; rhs)
01691     {
01692         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;16; ++i)
01693         {
01694             f[i] =rhs.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[i];
01695         }
01696         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01697     }
01698 <span class="comment">/*!***************************************************************************</span>
01699 <span class="comment"> @Function          *</span>
01700 <span class="comment"> @Input             rhs a PVRTVec4</span>
01701 <span class="comment"> @Returns           result of multiplication</span>
01702 <span class="comment"> @Description       Matrix multiplication of 4x4 matrix and vec3</span>
01703 <span class="comment">*****************************************************************************/</span>
01704     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTMat4.html#a5">operator*</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)<span class="keyword"> const</span>
<a name="l01705"></a><a class="code" href="structPVRTMat4.html#a8">01705</a> <span class="keyword">    </span>{
01706         <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
01707         out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[8])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[12]);
01708         out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[9])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[13]);
01709         out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[10])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[14]);
01710         out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[11])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[15]);
01711 
01712         <span class="keywordflow">return</span> out;
01713     }
01714 
01715 <span class="comment">/*!***************************************************************************</span>
01716 <span class="comment"> @Function          *=</span>
01717 <span class="comment"> @Input             rhs a PVRTVec4</span>
01718 <span class="comment"> @Returns           result of multiplication and assignment</span>
01719 <span class="comment"> @Description       Matrix multiplication and assignment of 4x4 matrix and vec3</span>
01720 <span class="comment">*****************************************************************************/</span>
01721     <a class="code" href="structPVRTVec4.html">PVRTVec4</a> <a class="code" href="structPVRTMat4.html#a10">operator*=</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec4.html">PVRTVec4</a>&amp; rhs)<span class="keyword"> const</span>
01722 <span class="keyword">    </span>{
<a name="l01723"></a><a class="code" href="structPVRTMat4.html#a9">01723</a>         <a class="code" href="structPVRTVec4.html">PVRTVec4</a> out;
01724         out.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[8])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[12]);
01725         out.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[9])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[13]);
01726         out.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[10])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[14]);
01727         out.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a> = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o0">x</a>,f[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o1">y</a>,f[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o2">z</a>,f[11])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(rhs.<a class="code" href="structPVRTVECTOR4f.html#o3">w</a>,f[15]);
01728 
01729         <span class="keywordflow">return</span> out;
01730     }
01731 
01732 <span class="comment">/*!***************************************************************************</span>
01733 <span class="comment"> @Function          inverse</span>
01734 <span class="comment"> @Returns           inverse mat4</span>
01735 <span class="comment"> @Description       Calculates multiplicative inverse of this matrix</span>
01736 <span class="comment">                    The matrix must be of the form :</span>
01737 <span class="comment">                    A 0</span>
01738 <span class="comment">                    C 1</span>
01739 <span class="comment">                    Where A is a 3x3 matrix and C is a 1x3 matrix.</span>
01740 <span class="comment">*****************************************************************************/</span>
01741     <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#a16">inverse</a>() <span class="keyword">const</span>;
<a name="l01742"></a><a class="code" href="structPVRTMat4.html#a10">01742</a> 
01743 <span class="comment">/*!***************************************************************************</span>
01744 <span class="comment"> @Function          inverseEx</span>
01745 <span class="comment"> @Returns           inverse mat4</span>
01746 <span class="comment"> @Description       Calculates multiplicative inverse of this matrix</span>
01747 <span class="comment">                    Uses a linear equation solver and the knowledge that M.M^-1=I.</span>
01748 <span class="comment">                    Use this fn to calculate the inverse of matrices that</span>
01749 <span class="comment">                    inverse() cannot.</span>
01750 <span class="comment">*****************************************************************************/</span>
01751     <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#a17">inverseEx</a>()<span class="keyword"> const</span>
01752 <span class="keyword">    </span>{
01753         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> out;
01754         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>        *ppRows[4];
01755         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>        pRes[4];
01756         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>        pIn[20];
01757         <span class="keywordtype">int</span>             i, j;
01758 
01759         <span class="keywordflow">for</span>(i = 0; i &lt; 4; ++i)
01760             ppRows[i] = &amp;pIn[i * 5];
01761 
01762         <span class="comment">/* Solve 4 sets of 4 linear equations */</span>
01763         <span class="keywordflow">for</span>(i = 0; i &lt; 4; ++i)
01764         {
01765             <span class="keywordflow">for</span>(j = 0; j &lt; 4; ++j)
01766             {
01767                 ppRows[j][0] = <a class="code" href="structPVRTMat4.html#e0">PVRTMat4::Identity</a>().<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[i + 4 * j];
01768                 memcpy(&amp;ppRows[j][1], &amp;f[j * 4], 4 * <span class="keyword">sizeof</span>(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>));
01769             }
01770 
01771             <a class="code" href="PVRTVector_8h.html#a0">PVRTLinearEqSolve</a>(pRes, (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>**)ppRows, 4);
01772 
01773             <span class="keywordflow">for</span>(j = 0; j &lt; 4; ++j)
01774             {
01775                 out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[i + 4 * j] = pRes[j];
01776             }
01777         }
01778 
01779         <span class="keywordflow">return</span> out;
<a name="l01780"></a><a class="code" href="structPVRTMat4.html#a11">01780</a>     }
01781 
01782 <span class="comment">/*!***************************************************************************</span>
01783 <span class="comment"> @Function          transpose</span>
01784 <span class="comment"> @Returns           transpose mat4</span>
01785 <span class="comment"> @Description       Calculates transpose of this matrix</span>
01786 <span class="comment">*****************************************************************************/</span>
01787     <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#a18">transpose</a>()<span class="keyword"> const</span>
01788 <span class="keyword">    </span>{
01789         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> out;
01790         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0] = f[0];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1] = f[4];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2] = f[8];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3] = f[12];
01791         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4] = f[1];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5] = f[5];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6] = f[9];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7] = f[13];
01792         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8] = f[2];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9] = f[6];        out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10] = f[10];      out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11] = f[14];
01793         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12] = f[3];       out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13] = f[7];       out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14] = f[11];      out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15] = f[15];
01794         <span class="keywordflow">return</span> out;
<a name="l01795"></a><a class="code" href="structPVRTMat4.html#a12">01795</a>     }
01796 
01797 <span class="comment">/*!***************************************************************************</span>
01798 <span class="comment"> @Function          postTranslate</span>
01799 <span class="comment"> @Input             tx distance of translation in x axis</span>
01800 <span class="comment"> @Input             ty distance of translation in y axis</span>
01801 <span class="comment"> @Input             tz distance of translation in z axis</span>
01802 <span class="comment"> @Returns           Returns this</span>
01803 <span class="comment"> @Description       Alters the translation component of the transformation matrix.</span>
01804 <span class="comment">*****************************************************************************/</span>
01805     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a19">postTranslate</a>(VERTTYPE tx, VERTTYPE ty, VERTTYPE tz)
01806     {
01807         f[12] += <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tx,f[0])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(ty,f[4])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tz,f[8]);
01808         f[13] += <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tx,f[1])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(ty,f[5])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tz,f[9]);
01809         f[14] += <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tx,f[2])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(ty,f[6])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tz,f[10]);
01810         f[15] += <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tx,f[3])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(ty,f[7])+<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(tz,f[11]);
<a name="l01811"></a><a class="code" href="structPVRTMat4.html#a13">01811</a> 
01812 <span class="comment">//          col(3) += tx * col(0) + ty * col(1) + tz * col(2);</span>
01813         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01814     }
01815 
01816 <span class="comment">/*!***************************************************************************</span>
01817 <span class="comment"> @Function          postTranslate</span>
01818 <span class="comment"> @Input             tvec translation vector</span>
01819 <span class="comment"> @Returns           Returns this</span>
01820 <span class="comment"> @Description       Alters the translation component of the transformation matrix.</span>
01821 <span class="comment">*****************************************************************************/</span>
01822     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a19">postTranslate</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; tvec)
01823     {
01824         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#a19">postTranslate</a>(tvec.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>, tvec.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>, tvec.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>);
01825     }
<a name="l01826"></a><a class="code" href="structPVRTMat4.html#a14">01826</a> 
01827 <span class="comment">/*!***************************************************************************</span>
01828 <span class="comment"> @Function          postTranslate</span>
01829 <span class="comment"> @Input             tx distance of translation in x axis</span>
01830 <span class="comment"> @Input             ty distance of translation in y axis</span>
01831 <span class="comment"> @Input             tz distance of translation in z axis</span>
01832 <span class="comment"> @Returns           Returns this</span>
01833 <span class="comment"> @Description       Translates the matrix from the passed parameters</span>
01834 <span class="comment">*****************************************************************************/</span>
01835     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a21">preTranslate</a>(VERTTYPE tx, VERTTYPE ty, VERTTYPE tz)
01836     {
01837         f[0]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],tx); f[4]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],tx); f[8]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[11],tx);    f[12]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[15],tx);
01838         f[1]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],ty); f[5]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],ty); f[9]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[11],ty);    f[13]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[15],ty);
01839         f[2]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[3],tz); f[6]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[7],tz); f[10]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[11],tz);   f[14]+=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(f[15],tz);
01840 
01841 <span class="comment">//          row(0) += tx * row(3);</span>
01842 <span class="comment">//          row(1) += ty * row(3);</span>
01843 <span class="comment">//          row(2) += tz * row(3);</span>
<a name="l01844"></a><a class="code" href="structPVRTMat4.html#a15">01844</a>         <span class="keywordflow">return</span> *<span class="keyword">this</span>;
01845     }
01846 
01847 <span class="comment">/*!***************************************************************************</span>
01848 <span class="comment"> @Function          postTranslate</span>
01849 <span class="comment"> @Input             tvec translation vector</span>
01850 <span class="comment"> @Returns           Returns the translation defined by the passed parameters</span>
01851 <span class="comment"> @Description       Translates the matrix from the passed parameters</span>
01852 <span class="comment">*****************************************************************************/</span>
01853     <a class="code" href="structPVRTMat4.html">PVRTMat4</a>&amp; <a class="code" href="structPVRTMat4.html#a21">preTranslate</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; tvec)
01854     {
01855         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#a21">preTranslate</a>(tvec.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>, tvec.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>, tvec.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>);
01856     }
01857 <span class="comment">/*!***************************************************************************</span>
01858 <span class="comment"> @Function          ptr</span>
01859 <span class="comment"> @Returns           pointer to an array of the elements of this PVRTMat4</span>
01860 <span class="comment"> @Description       Calculates transpose of this matrix</span>
01861 <span class="comment">*****************************************************************************/</span>
01862     <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> *<a class="code" href="structPVRTMat4.html#a23">ptr</a>() { <span class="keywordflow">return</span> (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>*)&amp;f; }
01863 
01864 <span class="comment">/*!***************************************************************************</span>
01865 <span class="comment">** Static factory functions</span>
01866 <span class="comment">*****************************************************************************/</span>
01867 <span class="comment">/*!***************************************************************************</span>
01868 <span class="comment"> @Function          Identity</span>
01869 <span class="comment"> @Returns           a PVRTMat4 representation of the 4x4 identity matrix</span>
01870 <span class="comment"> @Description       Generates an identity matrix</span>
01871 <span class="comment">*****************************************************************************/</span>
01872     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e0">Identity</a>()
01873     {
01874         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> out;
01875         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0] = <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1);out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3] = 0;
<a name="l01876"></a><a class="code" href="structPVRTMat4.html#a17">01876</a>         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5] = <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1);out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7] = 0;
01877         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10] = <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1);out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11] = 0;
01878         out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14] = 0;out.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15] = <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1);
01879         <span class="keywordflow">return</span> out;
01880     }
01881 
01882 <span class="comment">/*!***************************************************************************</span>
01883 <span class="comment"> @Function          RotationX</span>
01884 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested rotation</span>
01885 <span class="comment"> @Description       Calculates a matrix corresponding to a rotation of angle</span>
01886 <span class="comment">                    degrees about the X axis</span>
01887 <span class="comment">*****************************************************************************/</span>
01888     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e1">RotationX</a>(VERTTYPE angle);
01889 <span class="comment">/*!***************************************************************************</span>
01890 <span class="comment"> @Function          RotationY</span>
01891 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested rotation</span>
01892 <span class="comment"> @Description       Calculates a matrix corresponding to a rotation of angle</span>
01893 <span class="comment">                    degrees about the Y axis</span>
01894 <span class="comment">*****************************************************************************/</span>
01895     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e2">RotationY</a>(VERTTYPE angle);
01896 <span class="comment">/*!***************************************************************************</span>
01897 <span class="comment"> @Function          RotationZ</span>
01898 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested rotation</span>
01899 <span class="comment"> @Description       Calculates a matrix corresponding to a rotation of angle</span>
01900 <span class="comment">                    degrees about the Z axis</span>
01901 <span class="comment">*****************************************************************************/</span>
01902     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e3">RotationZ</a>(VERTTYPE angle);
01903 
01904 <span class="comment">/*!***************************************************************************</span>
01905 <span class="comment"> @Function          Scale</span>
01906 <span class="comment"> @Returns           a PVRTMat3 corresponding to the requested scaling transformation</span>
01907 <span class="comment"> @Description       Calculates a matrix corresponding to scaling of fx, fy and fz</span>
01908 <span class="comment">                    times in each axis.</span>
01909 <span class="comment">*****************************************************************************/</span>
01910     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e4">Scale</a>(<span class="keyword">const</span> VERTTYPE fx,<span class="keyword">const</span> VERTTYPE fy,<span class="keyword">const</span> VERTTYPE fz)
01911     {
01912         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#a0">PVRTMat4</a>(fx,0,0,0,
<a name="l01913"></a><a class="code" href="structPVRTMat4.html#a18">01913</a>             0,fy,0,0,
01914             0,0,fz,0,
01915             0,0,0,<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1));
01916     }
01917 
01918 <span class="comment">/*!***************************************************************************</span>
01919 <span class="comment"> @Function          Translation</span>
01920 <span class="comment"> @Returns           a PVRTMat4 corresponding to the requested translation</span>
01921 <span class="comment"> @Description       Calculates a 4x4 matrix corresponding to a transformation</span>
01922 <span class="comment">                    of tx, ty and tz distance in each axis.</span>
01923 <span class="comment">*****************************************************************************/</span>
01924     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e5">Translation</a>(<span class="keyword">const</span> VERTTYPE tx, <span class="keyword">const</span> VERTTYPE ty, <span class="keyword">const</span> VERTTYPE tz)
01925     {
01926         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#a0">PVRTMat4</a>(<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1),0,0,0,
01927             0,<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1),0,0,
01928             0,0,<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1),0,
01929             tx,ty,tz,<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1));
01930     }
01931 
<a name="l01932"></a><a class="code" href="structPVRTMat4.html#a19">01932</a> <span class="comment">/*!***************************************************************************</span>
01933 <span class="comment">** Clipspace enum</span>
01934 <span class="comment">** Determines whether clip space Z ranges from -1 to 1 (OGL) or from 0 to 1 (D3D)</span>
01935 <span class="comment">*****************************************************************************/</span>
01936     <span class="keyword">enum</span> <a class="code" href="structPVRTMat4.html#w2">eClipspace</a> { <a class="code" href="structPVRTMat4.html#w2w0">OGL</a>, <a class="code" href="structPVRTMat4.html#w2w1">D3D</a> };
01937 
01938 <span class="comment">/*!***************************************************************************</span>
01939 <span class="comment"> @Function          Ortho</span>
01940 <span class="comment"> @Input             left view plane</span>
01941 <span class="comment"> @Input             top view plane</span>
01942 <span class="comment"> @Input             right view plane</span>
01943 <span class="comment"> @Input             bottom view plane</span>
01944 <span class="comment"> @Input             nearPlane the near rendering plane</span>
01945 <span class="comment"> @Input             farPlane the far rendering plane</span>
01946 <span class="comment"> @Input             cs which clipspace convention is being used</span>
01947 <span class="comment"> @Input             bRotate is the viewport in portrait or landscape mode</span>
01948 <span class="comment"> @Returns           Returns the orthogonal projection matrix defined by the passed parameters</span>
01949 <span class="comment"> @Description       Translates the matrix from the passed parameters</span>
<a name="l01950"></a><a class="code" href="structPVRTMat4.html#a20">01950</a> <span class="comment">*****************************************************************************/</span>
01951     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e6">Ortho</a>(VERTTYPE left, VERTTYPE top, VERTTYPE right,
01952         VERTTYPE bottom, VERTTYPE nearPlane, VERTTYPE farPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
01953     {
01954         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> rcplmr = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>(1),(left - right));
01955         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> rcpbmt = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>(1),(bottom - top));
01956         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> rcpnmf = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>(1),(nearPlane - farPlane));
01957 
01958         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> result;
01959 
01960         <span class="keywordflow">if</span> (bRotate)
01961         {
01962             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0]=0;      result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(2,rcplmr); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8]=0; result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(-(right+left),rcplmr);
01963             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(-2,rcpbmt); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5]=0;      result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>((top+bottom),rcpbmt);
<a name="l01964"></a><a class="code" href="structPVRTMat4.html#a21">01964</a>         }
01965         <span class="keywordflow">else</span>
01966         {
01967             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(-2,rcplmr); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4]=0; result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8]=0; result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(right+left,rcplmr);
01968             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1]=0;      result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(-2,rcpbmt); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>((top+bottom),rcpbmt);
01969         }
01970         <span class="keywordflow">if</span> (cs == <a class="code" href="structPVRTMat4.html#w2w1">D3D</a>)
01971         {
01972             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10]=-rcpnmf;   result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(nearPlane,rcpnmf);
01973         }
01974         <span class="keywordflow">else</span>
01975         {
01976             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(-2,rcpnmf);    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(nearPlane + farPlane,rcpnmf);
01977         }
01978         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]=0; result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]=1;
01979 
01980         <span class="keywordflow">return</span> result;
01981     }
01982 
<a name="l01983"></a><a class="code" href="structPVRTMat4.html#a22">01983</a> 
01984 <span class="comment">/*!***************************************************************************</span>
01985 <span class="comment"> @Function          LookAtRH</span>
01986 <span class="comment"> @Input             vEye position of 'camera'</span>
01987 <span class="comment"> @Input             vAt target that camera points at</span>
01988 <span class="comment"> @Input             vUp up vector for camera</span>
01989 <span class="comment"> @Returns           Returns the view matrix defined by the passed parameters</span>
01990 <span class="comment"> @Description       Create a look-at view matrix for a right hand coordinate</span>
01991 <span class="comment">                    system</span>
01992 <span class="comment">*****************************************************************************/</span>
<a name="l01993"></a><a class="code" href="structPVRTMat4.html#a23">01993</a>     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e7">LookAtRH</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vEye, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vAt, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vUp)
01994         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e17">LookAt</a>(vEye, vAt, vUp, <span class="keyword">true</span>); }
01995 <span class="comment">/*!***************************************************************************</span>
01996 <span class="comment"> @Function          LookAtLH</span>
01997 <span class="comment"> @Input             vEye position of 'camera'</span>
01998 <span class="comment"> @Input             vAt target that camera points at</span>
01999 <span class="comment"> @Input             vUp up vector for camera</span>
02000 <span class="comment"> @Returns           Returns the view matrix defined by the passed parameters</span>
02001 <span class="comment"> @Description       Create a look-at view matrix for a left hand coordinate</span>
02002 <span class="comment">                    system</span>
02003 <span class="comment">*****************************************************************************/</span>
<a name="l02004"></a><a class="code" href="structPVRTMat4.html#e0">02004</a>     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e8">LookAtLH</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vEye, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vAt, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vUp)
02005         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e17">LookAt</a>(vEye, vAt, vUp, <span class="keyword">false</span>); }
02006 
02007 <span class="comment">/*!***************************************************************************</span>
02008 <span class="comment"> @Function      PerspectiveRH</span>
02009 <span class="comment"> @Input         width       width of viewplane</span>
02010 <span class="comment"> @Input         height      height of viewplane</span>
02011 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02012 <span class="comment"> @Input         farPlane    far clipping distance</span>
02013 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02014 <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02015 <span class="comment"> @Returns       Perspective matrix</span>
02016 <span class="comment"> @Description   Create a perspective matrix for a right hand coordinate</span>
02017 <span class="comment">                system</span>
02018 <span class="comment">*****************************************************************************/</span>
02019     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e9">PerspectiveRH</a>(VERTTYPE width, VERTTYPE height, VERTTYPE nearPlane,
02020         VERTTYPE farPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02021         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e18">Perspective</a>(width, height, nearPlane, farPlane, cs, <span class="keyword">true</span>, bRotate); }
02022 
02023 <span class="comment">/*!***************************************************************************</span>
02024 <span class="comment"> @Function      PerspectiveLH</span>
02025 <span class="comment"> @Input         width       width of viewplane</span>
02026 <span class="comment"> @Input         height      height of viewplane</span>
02027 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02028 <span class="comment"> @Input         farPlane    far clipping distance</span>
02029 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02030 <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02031 <span class="comment"> @Returns       Perspective matrix</span>
02032 <span class="comment"> @Description   Create a perspective matrix for a left hand coordinate</span>
02033 <span class="comment">                system</span>
02034 <span class="comment">*****************************************************************************/</span>
02035     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e10">PerspectiveLH</a>(VERTTYPE width, VERTTYPE height, VERTTYPE nearPlane, VERTTYPE farPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02036         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e18">Perspective</a>(width, height, nearPlane, farPlane, cs, <span class="keyword">false</span>, bRotate); }
02037 
02038 <span class="comment">/*!***************************************************************************</span>
02039 <span class="comment"> @Function      PerspectiveFloatDepthRH</span>
02040 <span class="comment"> @Input         width       width of viewplane</span>
02041 <span class="comment"> @Input         height      height of viewplane</span>
02042 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02043 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02044 <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02045 <span class="comment"> @Returns       Perspective matrix</span>
<a name="l02046"></a><a class="code" href="structPVRTMat4.html#e4">02046</a> <span class="comment"> @Description   Create a perspective matrix for a right hand coordinate</span>
02047 <span class="comment">                system</span>
02048 <span class="comment">*****************************************************************************/</span>
02049     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e11">PerspectiveFloatDepthRH</a>(VERTTYPE width, VERTTYPE height, VERTTYPE nearPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02050         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e19">PerspectiveFloatDepth</a>(width, height, nearPlane, cs, <span class="keyword">true</span>, bRotate); }
02051 
02052 <span class="comment">/*!***************************************************************************</span>
02053 <span class="comment"> @Function      PerspectiveFloatDepthLH</span>
02054 <span class="comment"> @Input         width       width of viewplane</span>
02055 <span class="comment"> @Input         height      height of viewplane</span>
02056 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02057 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02058 <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02059 <span class="comment"> @Returns       Perspective matrix</span>
02060 <span class="comment"> @Description   Create a perspective matrix for a left hand coordinate</span>
<a name="l02061"></a><a class="code" href="structPVRTMat4.html#e5">02061</a> <span class="comment">                system</span>
02062 <span class="comment">*****************************************************************************/</span>
02063     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e12">PerspectiveFloatDepthLH</a>(VERTTYPE width, VERTTYPE height, VERTTYPE nearPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02064         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e19">PerspectiveFloatDepth</a>(width, height, nearPlane, cs, <span class="keyword">false</span>, bRotate); }
02065 
02066 <span class="comment">/*!***************************************************************************</span>
02067 <span class="comment"> @Function      PerspectiveFovRH</span>
02068 <span class="comment"> @Input         fovy        angle of view (vertical)</span>
02069 <span class="comment"> @Input         aspect      aspect ratio of view</span>
02070 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02071 <span class="comment"> @Input         farPlane    far clipping distance</span>
02072 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
<a name="l02073"></a><a class="code" href="structPVRTMat4.html#w2">02073</a> <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02074 <span class="comment"> @Returns       Perspective matrix</span>
02075 <span class="comment"> @Description   Create a perspective matrix for a right hand coordinate</span>
02076 <span class="comment">                system</span>
02077 <span class="comment">*****************************************************************************/</span>
02078     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e13">PerspectiveFovRH</a>(VERTTYPE fovy, VERTTYPE aspect, VERTTYPE nearPlane, VERTTYPE farPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02079         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e20">PerspectiveFov</a>(fovy, aspect, nearPlane, farPlane, cs, <span class="keyword">true</span>, bRotate); }
02080 <span class="comment">/*!***************************************************************************</span>
02081 <span class="comment"> @Function      PerspectiveFovLH</span>
02082 <span class="comment"> @Input         fovy        angle of view (vertical)</span>
02083 <span class="comment"> @Input         aspect      aspect ratio of view</span>
02084 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02085 <span class="comment"> @Input         farPlane    far clipping distance</span>
02086 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02087 <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02088 <span class="comment"> @Returns       Perspective matrix</span>
<a name="l02089"></a><a class="code" href="structPVRTMat4.html#e6">02089</a> <span class="comment"> @Description   Create a perspective matrix for a left hand coordinate</span>
02090 <span class="comment">                system</span>
02091 <span class="comment">*****************************************************************************/</span>
02092     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e14">PerspectiveFovLH</a>(VERTTYPE fovy, VERTTYPE aspect, VERTTYPE nearPlane, VERTTYPE farPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02093         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e20">PerspectiveFov</a>(fovy, aspect, nearPlane, farPlane, cs, <span class="keyword">false</span>, bRotate); }
02094 
02095 <span class="comment">/*!***************************************************************************</span>
02096 <span class="comment"> @Function      PerspectiveFovRH</span>
02097 <span class="comment"> @Input         fovy        angle of view (vertical)</span>
02098 <span class="comment"> @Input         aspect      aspect ratio of view</span>
02099 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02100 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02101 <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02102 <span class="comment"> @Returns       Perspective matrix</span>
02103 <span class="comment"> @Description   Create a perspective matrix for a right hand coordinate</span>
02104 <span class="comment">                system</span>
02105 <span class="comment">*****************************************************************************/</span>
02106     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e15">PerspectiveFovFloatDepthRH</a>(VERTTYPE fovy, VERTTYPE aspect, VERTTYPE nearPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02107         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e21">PerspectiveFovFloatDepth</a>(fovy, aspect, nearPlane, cs, <span class="keyword">true</span>, bRotate); }
02108 <span class="comment">/*!***************************************************************************</span>
02109 <span class="comment"> @Function      PerspectiveFovLH</span>
02110 <span class="comment"> @Input         fovy        angle of view (vertical)</span>
02111 <span class="comment"> @Input         aspect      aspect ratio of view</span>
02112 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02113 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02114 <span class="comment"> @Input         bRotate is the viewport in portrait or landscape mode</span>
02115 <span class="comment"> @Returns       Perspective matrix</span>
02116 <span class="comment"> @Description   Create a perspective matrix for a left hand coordinate</span>
02117 <span class="comment">                system</span>
02118 <span class="comment">*****************************************************************************/</span>
02119     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e16">PerspectiveFovFloatDepthLH</a>(VERTTYPE fovy, VERTTYPE aspect, VERTTYPE nearPlane, <span class="keyword">const</span> eClipspace cs, <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02120         { <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e21">PerspectiveFovFloatDepth</a>(fovy, aspect, nearPlane, cs, <span class="keyword">false</span>, bRotate); }
02121 
02122 <span class="comment">/*!***************************************************************************</span>
02123 <span class="comment"> @Function          LookAt</span>
02124 <span class="comment"> @Input             vEye position of 'camera'</span>
02125 <span class="comment"> @Input             vAt target that camera points at</span>
02126 <span class="comment"> @Input             vUp up vector for camera</span>
02127 <span class="comment"> @Input             bRightHanded handedness of coordinate system</span>
02128 <span class="comment"> @Returns           Returns the view matrix defined by the passed parameters</span>
02129 <span class="comment"> @Description       Create a look-at view matrix</span>
02130 <span class="comment">*****************************************************************************/</span>
02131     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e17">LookAt</a>(<span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vEye, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vAt, <span class="keyword">const</span> <a class="code" href="structPVRTVec3.html">PVRTVec3</a>&amp; vUp, <span class="keywordtype">bool</span> bRightHanded)
<a name="l02132"></a><a class="code" href="structPVRTMat4.html#e7">02132</a>     {
02133         <a class="code" href="structPVRTVec3.html">PVRTVec3</a> vForward, vUpNorm, vSide;
02134         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> result;
02135 
02136         vForward = (bRightHanded) ? vEye - vAt : vAt - vEye;
02137 
02138         vForward.<a class="code" href="structPVRTVec3.html#a19">normalize</a>();
02139         vUpNorm = vUp.<a class="code" href="structPVRTVec3.html#a20">normalized</a>();
02140         vSide   = vUpNorm.<a class="code" href="structPVRTVec3.html#a22">cross</a>( vForward);
02141         vUpNorm = vForward.<a class="code" href="structPVRTVec3.html#a22">cross</a>(vSide);
02142 
02143         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0]=vSide.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4]=vSide.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8]=vSide.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;        result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12]=0;
<a name="l02144"></a><a class="code" href="structPVRTMat4.html#e8">02144</a>         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1]=vUpNorm.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5]=vUpNorm.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9]=vUpNorm.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;      result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13]=0;
02145         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2]=vForward.<a class="code" href="structPVRTVECTOR3f.html#o0">x</a>; result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6]=vForward.<a class="code" href="structPVRTVECTOR3f.html#o1">y</a>; result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10]=vForward.<a class="code" href="structPVRTVECTOR3f.html#o2">z</a>;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14]=0;
02146         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3]=0;          result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]=0;          result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]=0;             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]=<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1);
02147 
02148 
02149         result.<a class="code" href="structPVRTMat4.html#a19">postTranslate</a>(-vEye);
02150         <span class="keywordflow">return</span> result;
02151     }
02152 
02153 <span class="comment">/*!***************************************************************************</span>
02154 <span class="comment"> @Function      Perspective</span>
02155 <span class="comment"> @Input         width       width of viewplane</span>
02156 <span class="comment"> @Input         height      height of viewplane</span>
02157 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02158 <span class="comment"> @Input         farPlane    far clipping distance</span>
02159 <span class="comment"> @Input         cs          which clipspace convention is being used</span>
<a name="l02160"></a><a class="code" href="structPVRTMat4.html#e9">02160</a> <span class="comment"> @Input         bRightHanded    handedness of coordinate system</span>
02161 <span class="comment"> @Input         bRotate     is the viewport in portrait or landscape mode</span>
02162 <span class="comment"> @Returns       Perspective matrix</span>
02163 <span class="comment"> @Description   Create a perspective matrix</span>
02164 <span class="comment">*****************************************************************************/</span>
02165     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e18">Perspective</a>(
02166         VERTTYPE width, VERTTYPE height,
02167         VERTTYPE nearPlane, VERTTYPE farPlane,
02168         <span class="keyword">const</span> eClipspace cs,
02169         <span class="keywordtype">bool</span> bRightHanded,
02170         <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02171     {
02172         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> n2 = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(2),nearPlane);
02173         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> rcpnmf = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1),(nearPlane - farPlane));
02174 
02175         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> result;
02176         <span class="keywordflow">if</span> (bRotate)
<a name="l02177"></a><a class="code" href="structPVRTMat4.html#e10">02177</a>         {
02178             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4]=<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(-n2,width); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12]=0;
02179             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1] = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(n2,height);   result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13]=0;
02180         }
02181         <span class="keywordflow">else</span>
02182         {
02183             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0] = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(n2,width);    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12]=0;
02184             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5]=<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(n2,height); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13]=0;
02185         }
02186         <span class="keywordflow">if</span> (cs == <a class="code" href="structPVRTMat4.html#w2w1">D3D</a>)
02187         {
02188             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(farPlane,rcpnmf);  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(farPlane,rcpnmf),nearPlane);
02189         }
02190         <span class="keywordflow">else</span>
02191         {
<a name="l02192"></a><a class="code" href="structPVRTMat4.html#e11">02192</a>             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(farPlane+nearPlane,rcpnmf);    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14]=<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(farPlane,rcpnmf),n2);
02193         }
02194         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]=<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(-1);  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]=0;
02195 
02196         <span class="keywordflow">if</span> (!bRightHanded)
02197         {
02198             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10] = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10], <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(-1));
02199             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11] = <a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(1);
02200         }
02201 
02202         <span class="keywordflow">return</span> result;
02203     }
02204 
02205 <span class="comment">/*!***************************************************************************</span>
02206 <span class="comment"> @Function      Perspective</span>
<a name="l02207"></a><a class="code" href="structPVRTMat4.html#e12">02207</a> <span class="comment"> @Input         width       width of viewplane</span>
02208 <span class="comment"> @Input         height      height of viewplane</span>
02209 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02210 <span class="comment"> @Input         cs          which clipspace convention is being used</span>
02211 <span class="comment"> @Input         bRightHanded    handedness of coordinate system</span>
02212 <span class="comment"> @Input         bRotate     is the viewport in portrait or landscape mode</span>
02213 <span class="comment"> @Returns       Perspective matrix</span>
02214 <span class="comment"> @Description   perspective calculation where far plane is assumed to be at an infinite distance and the screen</span>
02215 <span class="comment">                space Z is inverted</span>
02216 <span class="comment">*****************************************************************************/</span>
02217     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e19">PerspectiveFloatDepth</a>(
02218         VERTTYPE width, VERTTYPE height,
02219         VERTTYPE nearPlane,
02220         <span class="keyword">const</span> eClipspace cs,
02221         <span class="keywordtype">bool</span> bRightHanded,
02222         <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
<a name="l02223"></a><a class="code" href="structPVRTMat4.html#e13">02223</a>     {
02224         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> n2 = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(2,nearPlane);
02225 
02226         <a class="code" href="structPVRTMat4.html">PVRTMat4</a> result;
02227         <span class="keywordflow">if</span> (bRotate)
02228         {
02229             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4]=<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(-n2,width); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12]=0;
02230             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1] = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(n2,height);   result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13]=0;
02231         }
02232         <span class="keywordflow">else</span>
02233         {
02234             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[0] = <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(n2,width);    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[4]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[8]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[12]=0;
02235             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[1] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[5]=<a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(n2,height); result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[9]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[13]=0;
02236         }
02237         <span class="keywordflow">if</span> (cs == <a class="code" href="structPVRTMat4.html#w2w1">D3D</a>)
<a name="l02238"></a><a class="code" href="structPVRTMat4.html#e14">02238</a>         {
02239             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10]=0; result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14]=nearPlane;
02240         }
02241         <span class="keywordflow">else</span>
02242         {
02243             result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[2] = 0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[6]=0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[10]=(bRightHanded?(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>)1:(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>)-1);   result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[14]=n2;
02244         }
02245         result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[3] = (<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>)0;  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[7]=(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>)0;    result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[11]= (bRightHanded?(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>)-1:(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>)1);  result.<a class="code" href="classPVRTMATRIXf.html#o0">f</a>[15]=(<a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a>)0;
02246 
02247         <span class="keywordflow">return</span> result;
02248     }
02249 
02250 <span class="comment">/*!***************************************************************************</span>
02251 <span class="comment"> @Function      Perspective</span>
02252 <span class="comment"> @Input         fovy        angle of view (vertical)</span>
<a name="l02253"></a><a class="code" href="structPVRTMat4.html#e15">02253</a> <span class="comment"> @Input         aspect      aspect ratio of view</span>
02254 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02255 <span class="comment"> @Input         farPlane    far clipping distance</span>
02256 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
02257 <span class="comment"> @Input         bRightHanded    handedness of coordinate system</span>
02258 <span class="comment"> @Input         bRotate     is the viewport in portrait or landscape mode</span>
02259 <span class="comment"> @Returns       Perspective matrix</span>
02260 <span class="comment"> @Description   perspective calculation where field of view is used instead of near plane dimensions</span>
02261 <span class="comment">*****************************************************************************/</span>
02262     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e20">PerspectiveFov</a>(
02263         VERTTYPE fovy, VERTTYPE aspect,
02264         VERTTYPE nearPlane, VERTTYPE farPlane,
02265         <span class="keyword">const</span> eClipspace cs,
02266         <span class="keywordtype">bool</span> bRightHanded,
<a name="l02267"></a><a class="code" href="structPVRTMat4.html#e16">02267</a>         <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02268     {
02269         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> height = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(2.0f),nearPlane),<a class="code" href="PVRTFixedPoint_8h.html#a33">PVRTTAN</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(fovy,<a class="code" href="PVRTFixedPoint_8h.html#a25">f2vt</a>(0.5f))));
02270         <span class="keywordflow">if</span> (bRotate) <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e18">Perspective</a>(height, <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(height,aspect), nearPlane, farPlane, cs, bRightHanded, bRotate);
02271         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e18">Perspective</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(height,aspect), height, nearPlane, farPlane, cs, bRightHanded, bRotate);
02272     }
02273 
02274 <span class="comment">/*!***************************************************************************</span>
02275 <span class="comment"> @Function      Perspective</span>
02276 <span class="comment"> @Input         fovy        angle of view (vertical)</span>
02277 <span class="comment"> @Input         aspect      aspect ratio of view</span>
02278 <span class="comment"> @Input         nearPlane   near clipping distance</span>
02279 <span class="comment"> @Input         cs          cs which clipspace convention is being used</span>
<a name="l02280"></a><a class="code" href="structPVRTMat4.html#e17">02280</a> <span class="comment"> @Input         bRightHanded    handedness of coordinate system</span>
02281 <span class="comment"> @Input         bRotate     is the viewport in portrait or landscape mode</span>
02282 <span class="comment"> @Returns       Perspective matrix</span>
02283 <span class="comment"> @Description   perspective calculation where field of view is used instead of near plane dimensions</span>
02284 <span class="comment">                and far plane is assumed to be at an infinite distance with inverted Z range</span>
02285 <span class="comment">*****************************************************************************/</span>
02286     <span class="keyword">static</span> <a class="code" href="structPVRTMat4.html">PVRTMat4</a> <a class="code" href="structPVRTMat4.html#e21">PerspectiveFovFloatDepth</a>(
02287         VERTTYPE fovy, VERTTYPE aspect,
02288         VERTTYPE nearPlane,
02289         <span class="keyword">const</span> eClipspace cs,
02290         <span class="keywordtype">bool</span> bRightHanded,
02291         <span class="keywordtype">bool</span> bRotate = <span class="keyword">false</span>)
02292     {
02293         <a class="code" href="PVRTFixedPoint_8h.html#a0">VERTTYPE</a> height = <a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(2,nearPlane), <a class="code" href="PVRTFixedPoint_8h.html#a33">PVRTTAN</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(fovy,0.5)));
02294         <span class="keywordflow">if</span> (bRotate) <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e19">PerspectiveFloatDepth</a>(height, <a class="code" href="PVRTFixedPoint_8h.html#a23">VERTTYPEDIV</a>(height,aspect), nearPlane, cs, bRightHanded, bRotate);
02295         <span class="keywordflow">return</span> <a class="code" href="structPVRTMat4.html#e19">PerspectiveFloatDepth</a>(<a class="code" href="PVRTFixedPoint_8h.html#a22">VERTTYPEMUL</a>(height,aspect), height, nearPlane, cs, bRightHanded, bRotate);
02296     }
02297 };
02298 
02299 <span class="preprocessor">#endif </span><span class="comment">/*__PVRTVECTOR_H__*/</span>
02300 
02301 <span class="comment">/*****************************************************************************</span>
02302 <span class="comment">End of file (PVRTVector.h)</span>
02303 <span class="comment">*****************************************************************************/</span>
02304 
</pre></div><br>
<br>
<P align=left><FONT size=2><STRONG><A 
   href="http://www.imgtec.com/powervr/insider/legal/index.asp">Copyright</A> � 
   1999-2008, Imagination Technologies Ltd.</STRONG></FONT></P>
<hr>
<address style="align: left;"><small><FONT color=f0f>
Generated by <a href="http://www.doxygen.org/index.html">DOXYGEN</a> 1.3.6</small></address>
</body>
</html>
